Yes, it's legal. Most folks who run gun shops are very aware of what they can and can't do, thanks to the ever-present checkups by the ATF. The records they keep on the computer are exactly the same as the ones you fill out on paper.
As EPG mentioned, those records are kept by the dealer for 20 years, or until they go out of business. In that case, they get sent to the ATF.