Here is a very general rule:
Cards from Alpha, Beta, and Unlimited, even commons, can be worth decent money. If you have cards from these sets in good condition, look up the value. Even basic lands from Alpha are worth money.
The only cards that can be expected to retain any value are on the Reserved List. Twenty-something years ago, there was fan outcry when Wizards of the Coast reprinted some cards in newer sets, as the collectors were worried that their cards would go down in value. In response, the company created the Reserved List, which is a long list of cards that Wizards promised to not reprint. The company has promised to not reprint Black Lotus, for example, so you it is safe to say that the price of the card will not tank because of new supply. No new cards are ever put on the Reserved List, so you cannot bet on any new cards to retain their value, as any in-demand cards can just be reprinted by Wizards whenever they want.
Sealed product from a few years ago are worth money, but as has been pointed out in this thread, the cat's out of the bag these days. Twenty years ago, people were not buying sealed boxes as investments. Therefore there is low supply in an extremely high-demand hobby.
These days there are a lot of people that are "investing" in Magic cards. While there may be 100 sealed Alpha boxes in the world at the moment (which would be a very generous estimate), there are tens of thousands of sealed boxes of Throne of Eldraine.
There is no doubt that a sealed box of Throne of Eldraine will be more valuable five years from now than it is now, but with fees, risks of scams, storage, etc., I would be surprised if it just beat the S&P 500.
Before investing, I highly suggest you watch some videos on the Alpha Investments Youtube channel. This is a good place to start
https://youtube.com/playlist?list=PL...z5WcJ6x1wfcoL2
If you don't play Magic, I don't really suggest that you get into investing in it. The fun of investing in Magic cards are that you like the game, so you make money doing something you like. If you don't know anything about the history of the game, you are setting yourself up to make bad investments.