By Federal law, you fill out a 4473 form for a background check and the transfer is in the “bound book” of the dealer making the transfer (new firearm or firearm transfered over state lines or a used gun purchased from a licensed dealer). The dealer keeps this record and turns it into the ATF when he/she gives up their firearms license.
The government is forbidden to compile this data into a defacto registration system... The FBI was caught doing just that though...
Do they have a way to trace a firearm at least to the original purchaser? Yes.
Do they know every transfer of every firearm and have ready data on the location of firearms and their owners? No.
All the ATF has to do is suspend or revoke existing licenses and they’ll have all the records they ever wanted.