Whether investors realize it or not, they've been witnesses to history. Since bottoming 16 months ago, the benchmark S&P 500 (^GSPC 1.20%) has rallied 98%, marking the strongest bounce from a bear-market bottom.

But whereas history is a long-term ally of investors, it can be the enemy of Wall Street, at least in the near term. That's because all signs continue to suggest that a stock market crash or steep correction is on its way.

A twenty dollar bill paper airplane that's crashed and crumpled into a financial newspaper.

Image source: Getty Images.

Crashes and steep corrections are unavoidable

Think about this for a moment: In each of the previous eight bear markets (i.e., not counting the coronavirus crash of 2020), there was at least one double-digit percentage decline in the S&P 500 within the first three years of bouncing back from the bottom. In five of those eight bounce-back rallies, we witnessed two double-digit percentage dips. In other words, the stock market never rebounds as smoothly as things have been over the past 16 months.

Valuation warning flags have also been waving all year. Despite historically dovish monetary policy from the Federal Reserve, there's only been one time in history where the S&P 500 was as pricey as it is now.

Of the previous four instances where the S&P 500's Shiller price-to-earnings (P/E) ratio topped and sustained 30 (currently 38.4), the index subsequently lost at least 20% of its value. The Shiller P/E examines inflation-adjusted earnings over the previous 10 years.

Macroeconomic factors stand ready to sink Wall Street, as well. Rapidly rising levels of inflation threaten to shrink what consumers and businesses will be able to purchase, thereby putting a stranglehold on economic growth. Likewise, the growing spread of the coronavirus delta variant could result in the reinstitution of measures designed to mitigate its spread. Some of these measures could reduce capacity in retail and service-oriented businesses or simply cause consumers and businesses to holster their disposable capital.

One last thing: Don't overlook that there have been 38 declines in the S&P 500 of at least 10% since the beginning of 1950, according to data from market analytics firm Yardeni Research. As disliked as they may be, crashes and corrections are a normal part of the investing cycle.

Big dips are the perfect opportunity to buy great businesses at a discount

However, crashes and steep corrections also offer the opportunity to buy into great businesses at a discount. While near-term trouble is a strong possibility, history is also quite clear that buying and holding great companies for long periods of time is a proven formula to build wealth. When the next stock market crash does strike, the following trio of companies would be perfect to buy.

Two employees looking at computer screens filled with data.

Image source: Getty Images.

Palantir Technologies

First up is data-mining giant Palantir Technologies (PLTR 3.19%). The company isn't exactly inexpensive based on its multiple relative to forecasted sales, but there's no other company that provides artificial-intelligence inspired data mining quite like it. That makes Palantir an excellent candidate to scoop up during a crash.

Palantir's biggest revenue generator for the time being is its Gotham platform, which primarily caters to the U.S. government. Gotham is responsible for helping the U.S. government with data culling and various missions. A number of large recent contracts helped push sales in its government business segment up 76% in the first quarter, with 83% sales growth from U.S. government customers. 

While there's no question that government contracts provide cash flow stability in the near term, Palantir's bigger long-term opportunity involves its Foundry platform. Foundry caters to enterprise customers and is designed to help them better understand their data in order to streamline their operations.

Though sales growth is more tepid at the moment in Palantir's commercial segment, the customer pool is substantially larger. It also doesn't hurt that commercial customers tend to sign longer-duration contracts than government customers.

When the next market crash inevitably strikes, consider buying Palantir.

A large dispensary sign featuring a green cannabis leaf in front of a retail store.

Image source: Getty Images.

Trulieve Cannabis

Another interesting thing we learned during the coronavirus pandemic is that cannabis is treated as a traditional consumer good. This is to say that demand for pot products is relatively steady, no matter how well or poorly the economy and stock market performed. This demand predictability makes U.S. marijuana stock Trulieve Cannabis (TCNNF 0.41%) a no-brainer buy during a crash or steep correction.

Most U.S. multistate operators (MSO) have a tendency to establish a presence in as many legalized markets as possible. However, this hasn't been Trulieve's modus operandi. Rather, Trulieve has opened 87 of its 96 nationwide dispensaries in one state, where only medical marijuana has been legalized: Florida.

By saturating the Sunshine State, Trulieve has been able to build up its brand and keep its marketing costs down. As a result, it's reported 13 consecutive profitable quarters and gobbled up roughly half of Florida's dried cannabis flower and cannabinoid oils market share.

Trulieve Cannabis is also looking to make waves on the acquisition front. In May, it announced an all-stock deal valued at $2.1 billion to acquire MSO Harvest Health & Recreation (HRVSF).

Harvest Health has a focus on five states, one of which happens to be Florida -- thus, Trulieve's lead in the Sunshine State will further expand. But it's the company's 15 operating dispensaries in its home market of Arizona that's the real prize. Arizona legalized recreational weed in November and commenced adult-use sales in January 2021. Trulieve shouldn't have any trouble becoming a major player in the Grand Canyon State. 

Cannabis will likely be one of the top growth industries this decade, making Trulieve a smart buy on market weakness.

A young woman holding a credit card in her left hand, with an open laptop in front of her.

Image source: Getty Images.

Mastercard

A third stock to buy when the next market crash strikes is payment-processing behemoth Mastercard (MA 1.33%).

Like most financial stocks, Mastercard is cyclical. This is a fancy way of saying that it's not impervious to downside or operating weakness when an economic contraction or recession arises. If people and businesses spend less, Mastercard is going to generate less merchant revenue.

But understand that recessions are often measured in months or a couple of quarters. By comparison, economic expansions and bull markets are multiyear events. An investment in Mastercard is effectively a bet on U.S. and global gross domestic product increasing over time.

It's worth pointing out that Mastercard currently holds the No. 2 spot in the U.S. in terms of credit card network purchasing volume. The U.S. is the leading market for consumption in the world. With most global transactions still being conducted in cash, Mastercard has a multi-decade opportunity to expand its infrastructure and innovate on the payments front.

Mastercard's secret sauce to steady growth also involves its avoidance of lending. By strictly sticking to the processing side of the equation, Mastercard removes itself from the possibility of being exposed to credit delinquencies during a recession.

Not having to set aside cash to cover bad loans is a big reason Mastercard can bounce back so quickly after crashes and recessions. Historically, it's been a smart buy anytime the stock market declines by a double-digit percentage.