The market presented long-term investors with a gift in 2022. It doesn't feel like it right now with stock prices falling precipitously month after month, but if you're planning to be in the market for decades, now is an ideal time to buy stocks. Earnings multiples are back to the long-term average. Growth and technology stocks trade at even bigger discounts, with many shares down 70% or 80% in the past year.

The best thing to do if you have cash available is to find some high-quality businesses trading at bargain prices and hold on for the long term. Here are two bargain stocks to buy today and hold forever. 

1. Nintendo: A durable entertainment giant 

While it's not quite Walt Disney with its huge stable of billion-dollar brands, Nintendo (NTDOY -0.82%) is one of the few companies out there with a comparable number of popular entertainment franchises to build on. The Japanese video game maker has been a worldwide leader in entertainment for decades, building popular brands like Mario, Zelda, Animal Crossing, and Splatoon (it also owns a minority stake in Pokemon). Unlike other game makers, Nintendo also produces its own proprietary gaming hardware and has done so for decades. Its most recent iteration is the Nintendo Switch, the most popular game system since its launch in 2017, selling over 100 million devices worldwide.

With so many devices in consumers' hands, Nintendo saw its profits soar over the last few years. This fiscal year -- which ends in March -- Nintendo expects to sell 21 million Switch devices and 210 million software units (games and subscriptions). Financially, management expects the company to generate approximately $3.46 billion in operating income. With a market cap of $46.3 billion, which comes down to an enterprise value (EV) of $35.5 billion when you exclude Nintendo's large cash position, the stock has a forward price-to-operating income (P/OI) of 10.3.

Investors should also consider that Nintendo is highly conservative with its forward financial guidance, meaning that it is likely the company will beat this profit guidance for the full fiscal year. No matter how you slice it, the stock looks cheap at these prices.

The combination of innovative hardware and software products has kept Nintendo atop the gaming world for the last 30-plus years. I expect this to continue for the next few decades as well, given how popular its entertainment brands are. At a low earnings multiple, the stock looks like a great buy at its current bargain price. 

2. Dropbox: A forgotten Silicon Valley story

Workplace management software may not be as exciting as Nintendo, but the product category is durable and should stick around for many decades to come. That is why I'm excited about dirt cheap stock Dropbox (DBX -0.17%) at the moment.

The file sharing, cloud storage, and workflow platform started in 2007 and became one of the most popular Silicon Valley start-ups of the last decade, gaining hundreds of millions of users in a short time span. It went public in early 2018 in a popular IPO listing but has since been forgotten by investors, with shares still around the same price almost five years later. 

But the business continues to grow as it slowly upsells its free users to paid storage subscription tiers. The company's revenue is up over 100% since going public, driven by steady growth in paying users from 11.9 million in 2018 to 17.37 million today. With over 700 million registered users, Dropbox still has a ton of room to upsell more customers to become paying users this decade.

This growth has brought solid operating leverage to Dropbox's business, since the majority of its costs are fixed. Over the last three years, free cash flow is up 82%. And, since the company has started reducing share count through heavy share repurchases, its free cash flow per share is up 98%. Free cash flow per share is a useful metric because it shows how much cash is being generated for every share you own of the company. 

Chart showing Dropbox's free cash flow and free cash flow per share rising since 2020.

DBX Free Cash Flow data by YCharts

With growing profits and a stock price that hasn't moved, Dropbox now trades at a cheap multiple of free cash flow. This year, management is guiding for $760 million in free cash flow at the low end of its guidance, and wants to hit $1 billion in free cash flow in 2024. At a market cap of $7.57 billion, the stock trades at a forward price-to-free cash flow (P/FCF) of 10 if this $760 million target is hit, or well below the market average. With Dropbox's track record of growth, the stock looks like a great company to own at a bargain price, making now a great time to buy if you plan to hold on for many years.