Why is Gun Registration/Licensing Even Legal?

I'm looking for thoughts from folks on this topic. 18 USC 926(a) specifically prescribes against the establishment of systems of licensing and registration for owners or guns and yet, States seem to do it.

Am I misreading the law here? If so, please clarify? If not, please tell me how registration of any gun or licensing of owners (IL FOID anyone?) are legal under this statute? I'd love legal opinions from lawyers who deal with 2A cases.

Just wondering aloud, folks. This is a pet peeve of mine.

The law restrains the US

The law restrains the US Attorney General, nobody else.

(a) The Attorney General may prescribe only such rules and regulations as are necessary to carry out the provisions of this chapter, including—
...
No such rule or regulation prescribed after the date of the enactment of the Firearms Owners’ Protection Act may require ...