Short answer? They were made there, or recovered by the government and bypassed ATF restrictions.
Lend-Lease weapons were made here, and shipped out.
Italian and Greek M1s (and some Danish, more further down) were made with tooling provided by Uncle Sam, but manufactured over there.
Winchester's M1 Garand tooling ended up in Italy in 1952, which gave Beretta a head-start on building their own M1 Garands, as well as their fabulous BM-59, beating the U.S. M14 to the punch by several years. Never mind the fact that a Beretta-made M1 Garand is head and shoulders above a Springfield/Winchester/H&R/IHC M1 Garand in fit and finish. Even my Beretta BM-59 Nigerian makes an M14 look like it had been dragged behind a jeep for a long time.
The Danish Garands were not issued under Lend-Lease (Denmark was occupied during the war), and the first 20K rifles were simply loaned to them around 1950. The Danes just returned them to us, and they went directly into Anniston's inventory (bypassing ATF import restrictions), put on the books like a standard USGI M1 Garand, ready for DCM/CMP sales. The remaining 40K rifles were actually purchased by the Danes, and after being phased out of service in the 1990s they've since been sold to Canadian firms, where they are parted out and sold to U.S. suppliers as parts/pieces. The Danes also started buying Beretta-made Garands, which are also perfectly fine in importing under the onerous ATF rules.
As for the Italian M1 Carbines that the DCM/CMP is now selling, it appears they have used a work-around to the Military Assistance Program non-import rules, beginning around 2007. The DCM/CMP received them directly from the U.S. Army, which probably circumvented any ATF commercial FFL import restrictions.
IOW, there's more than one way to skin a cat. The U.S. Army can recover it's loaned-out property via government channels, and sell them via the government-sponsored DCM/CMP, but SOG, Century Arms, and other commercial FFL importers are left holding the bag. Go figure...