Can't own a machine gun in the US without special permit. Or barrel is plugged with solder or de-activated in some manner. Some military stuff is excepted with special permit as well - gotta make movies ya know.
Some time I will tell you the story about the rubber tired tank we rented in Hollywood in the early 70s and the San Diego Freeway......
I imagine these days the autorities would be a bit averse to permitting working machine guns just so that movies could have their realism.
After all, they can insert all kinds of effects and graphics so that things look better than real. I can't see few muzzle flasshes and a bolt slamming back and forth being good enough reason for a movie production company to get a machine gun permit.
But then we are talking about the US and Hollywood...........lol

(P.S. I don't know if you're aware but the rest of the world has a 'saying', albeit affectionate. "It could only happen in America!)................. ;D

j/k