It's even codified and part of ISO standards [1]. It's not a conspiracy, it's simply Discovercard putting a UI around data that's already being collected.
> Some places surfaces this information to you, in various ways.
Citibank includes this code in the "SID" element in OFX generated by their "OFX Direct" service (i.e. https://www.accountonline.com/cards/svc/CitiOfxManager.do). I haven't seen it in the OFX from any other financial institution though. The codes are cataloged here: https://github.com/greggles/mcc-codes
All merchants that accept credit cards are placed in a category by the card companies, and every credit or debit card purchase therefore gets this category attached to it. Some places surfaces this information to you, in various ways. I have Chase, and they have a pretty shitty UI for this, but there's something there at least.
So it's not unique to Discover, and it's not them "guessing" or trying, it's based on fixed merchant categories.