Back when I was a teenager, all ammo purchases had to be logged in to a book at the gun store. I believe it was federal law at the time.
I don't recall exactly when it was stopped, but it used to be the law. That was in the 1970s.
Couldn't have been a federal law. In Indiana, I never had to show ID to buy ammo in the 70's.