Randomness is an inherent aspect of any videogame loot box: Maybe there's something good inside, or maybe you get stuck with something you've already got 16 copies of. But you do get something—and that, according to Kotaku, is why the ESRB—the Entertainment Software Rating Board, which categorizes games released in North America from "Early Childhood" to "Adults Only"—does not consider them to be a form of gambling.
"While there’s an element of chance in these mechanics, the player is always guaranteed to receive in-game content (even if the player unfortunately receives something they don’t want)," an ESRB rep told the site. "We think of it as a similar principle to collectible card games: Sometimes you’ll open a pack and get a brand new holographic card you’ve had your eye on for a while. But other times you’ll end up with a pack of cards you already have."
It's an important distinction, because as the ESRB ratings guide page explains, one of the criteria for the AO (Adults Only) rating is "gambling with real currency." Categorizing loot boxes as gambling would open up every game that offers them, including very mainstream stuff like Overwatch, Hearthstone, Destiny 2, and Assassin's Creed, to the dreaded 18-only AO sticker. That doesn't mean much in digital environments like Steam, where ESRB ratings are effectively irrelevant, but in the world of regular retail, it's the kiss of death.
On top of that very practical consideration, I would opine that the ESRB's take is the correct one. The organization is funded by publishers, and so it's arguable (if perhaps a bit cynical) that it has a vested interest in keeping games as accessible as possible, which naturally means holding those AO ratings to a bare minimum. But as a child, while I couldn't legally buy lottery tickets, I could blow untold amounts of cash on baseball and Star Wars cards, amassing multi-hundred-card collections of both while never quite managing to put together a complete set of any. I was rolling the dice with my money, relying on fickle fortune to score that Ralph McQuarrie concept art card I so desperately wanted (and, by the way, never got), and yes, by some measures that is awfully close to sinking money into scratch-off cards in hopes of the big payout. But as the ESRB rep said, buying a pack of five cards guarantees that I will get five cards—buying a scratch-off only guarantees that I'll end up with grey crud under my fingernail.
None of which is to say that the success of loot boxes isn't rooted in throwing the levers on the same sort of psychological urges that drive people to sit for hours on end in front of casino slot machines, a topic we dug into in detail right here. But it's really nothing new, and more to the point, the ESRB isn't going to protect you from yourself on this. If you don't like 'em, don't buy 'em—and if you keep on buying them, don't be surprised and indignant when publishers keep working them into their games.