Yes, that's exactly how it works. The unopened package in near perfect condition is considered extraordinarily scarce.
It's the scarcity factor via grading that is being applied. That's obviously a graded Mario 64 package, not just a stray cartridge (of which there are zillions of copies as you note).
The supply, in the collectible world, is thus considered to be exceptionally low. You're talking about a sealed box, top notch grade. There are only a small number of those still in existence.
Here is the image of the graded Mario game:
https://ichef.bbci.co.uk/news/976/cpsprodpb/12EF3/production...
It's a 9.8, which is a very high grade for a vintage video game box. As far as the collectors are concerned, that's a very scarce item. The value is in the condition of the box and that it's sealed. Without that, you could just buy the item on eBay for ~$30-$50.
You see the exact same outcome in the comics world, for graded comics. And it's identical to the quality + grading = scarcity aspect in baseball / basketball / pokemon cards.
1969 is Mickey Mantle's last year for Topps baseball cards. There are a lot of copies of that card in existence, relatively speaking. You can buy it ungraded for $100-$1,000 depending on the condition you want. If you want a PSA 10 of that card (there are only two)? Be ready to pay $500,000+. That's the same exact scarcity by grading mechanism in action as with the 9.8 graded Mario cartridge, it's because there are not very many of them in that condition.