creditors have tracked purchasing categories since the 1930's and older than that if you want to consider actual ledgers as a data source. this is important for documenting what sectors and markets their financial products are being used in so they can better position themselves in the market. prior to the 90's, firearms were in 4 categories: department stores (5311), sporting goods (5941), catalog sales (5964), and various security services under contract (7393). after 2017 was proposed separating out firearms specifically from these categories since it wasn't common in department stores or catalog sales anymore, and security services were for professional services, not retail sales. pawn shops had their own code which i don't remember that also included firearms in them, and there are construction services for things like demolitions or blanks for nail guns, et c.
the anti-gun lobby wanted it to be it's own code for that product category so that legislation could be drawn up to specifically exclude it from various credit programs or cash withdrawals or ACH payments. a lot of states do this for securities trading or gambling or OTC drugs for example, so it's not something new. alcohol is another one that's scattered in like a dozen codes and doesn't really have its own in the same way gambling does.
i'm not worried about visa or whomever tracking purchases, i would be worried about them caving to ideological pressure to deny those transactions, or for pressure on legislatures to specifically ban those merchant codes from various types of transactions (like ATMs), turning guns into a cash-only type service, which already has a poor reputation in other industries.
handy searchable MCC codes:
https://github.com/greggles/mcc-codes