FFL/SOT dealers can only purchase post-1986 machine guns if they submit to BATF a specific demonstration request, on department letterhead stationery, from an LE agency. BATF limits them to owning one example of each type of firearm -- for instance, they probably would be approved for both an M16A2 and an M4, but not for an M4 and an M4A3.
Once they have it in inventory, they can keep it for future demos for other LE agencies. The regs are somewhat murky about other uses -- in theory, I guess, when you see them at MG shoots they are doing open demos, or testing particular MG/ammo/optics combinations, etc. The use of post-1986 MGs for rental purposes is one of those areas best left undiscussed.
Of course, they can only sell the demo MGs to an LE agency or to another FFL/SOT who has a valid LE demo letter to submit to BATF.
All post-1986 MGs must be disposed of before the FFL/SOT goes out of business; once his licenses expire, any post-1986 MGs in his inventory instantly become unregistered contraband. There are instances of BATF stretching this rule and giving former dealers extra time to dispose of post-'86 inventory, but such decisions are entirely at the discretion of the BATF.