So, how did they figure out where the guns came from? Did the just ask the criminal?!
All firearms sold in the USA have serial numbers. When the manufacturer or dealer sells or otherwise disposes of a firearm, they keep a record of who it went to. These records are retained by the dealer until they go out of business, then they are sent to an BATFE records storage in Georgia. The records stay around for a long time.
When a firearm is recovered at a crime scene or from someone suspected of a crime and the serial number is still intact, the police can find out who last took poccession from a dealer. From there they can sometimes track ownership of the firearm even if it was sold without a 4473 record (legal in most states, but not CA).
Many of the people selling firearms at gun shows are dealers. This is one of the ways they can advertise their wares. Some gun shows require that anyone buying a firearm be able to provide background check info.
And sometimes the criminal provide accurate information on who they got their firearms.
Ranb