Traditionally I believe they used 5-in-1 blank firing guns that got around the full auto laws. That's what you see in all the Hollywood classic westerns. Blank shooting guns have continued to be a mainstay until fairly recently. The AR's you see in Scarface and Heat are blank adapted but are or were real rifles. I'm not sure about the legalities involved, but I believe they render them unable to fire real ammunition and they're maintained in the possession of a prop master or contractor.
You're close, but not quite there.
The old "5 in 1" blanks were used because one blank would work in five different caliber guns used in Western movies. (The calibers were .38-40 and .44-40 rifles and .38-40, .44-40 and .45 revolvers)
The guns used in old Westerns were real guns and, since they were manual repeaters, didn't even need to be modified to fire blanks. They were still legally firearms. In fact, the ATF came down on the producers of "Wanted: Dead or Alive" because the "Mare's leg" pistol carried by Steve McQueen had not been registered as a SBR before being manufactured. (Back then they allowed the producers to simply register the cut-down rifles and pay the tax. Today it would probably be more of an issue)
Many movies use more modern semi-autos or full-autos. The guns are still legally firearms and all legal rules remain in effect. The guns are modified with barrel inserts near the muzzle to keep the gas pressure high enough to cycle the action. This inserts are very easy to remove and the status of the firearm as a "real gun" is unchanged.
The rifles and MG's in "Heat" were real guns and all laws regarding MG's remained in effect. The rental companies that provided the guns had the appropriate ATF FFL's (usually MG dealer or MG manufacturer) and a representive from the company was responsible for the guns during the shoot and had to be present at all times.
Basically, these firearms rental companies own inventories of either Pre-May transferable MG's or Post-May "Dealer Sample" MG's. If they have the SOT FFL they can even manufacture new MG's (but cannot sell them except to another SOT).
When Stembridge Guns closed 15 or so years ago hundreds of their guns, including many MG's, were sold on the open market. These were registered so it was an infusion of transferable MG's to the collector market that had all been owned by the same company for decades.
Even with big budget movies "non guns" are sometimes used. If the gun isn't shown close up it may be a rubber dummy gun. These are often carried by extras in the background. A bunch of rubber M-1 Garands were made for Saving Private Ryan and sold off later.
The trend in lower budget movies is to use Airsoft or similiar guns and add effects later. This is not only safer but much less expensive since the Airsoft don't have to be as tightly controlled as the real firearms, especially MG's.