The Nasdaq index is down over 30% this year and even more from its 52-week high in November 2021. Now that it is entrenched in bear market territory, it can be scary for investors. But smart investors understand the history of bear markets and what they all have in common. More importantly, they know how to get richer base on that knowledge.

There have been 22 bear markets since 1928 (measured by the S&P 500 index). Those bear markets have ranged from a 20.6% decline (barely meeting the negative 20% threshold) to 83% in the depths of the Great Depression in 1930. And the one thing every bear market has in common: They all were followed by a recovery.

Some of those bear markets have yielded spectacular bull markets. For instance, the bear market in 1949 reached its lowest level on June 13. The ensuing bull market ran for more than seven years and gained 267.1% when it peaked. When the Great Recession troughed on March 9, 2009, a bull market produced a 400.5% gain and lasted 1,997 days (nearly five and a half years). Perhaps most astonishingly, the bear market induced by Black Monday reached its nadir on Dec. 4, 1987. After that, it only took 701 days (less than two years) for the market to gain 582.1%.

It's difficult to see your account evaporate from a bear market and have the fortitude to buy more beaten-down shares, but that's what smart investors do. One of the smartest, Warren Buffett, said that when it's raining gold, don't bring out a thimble, bring a bucket.

In other words, bear markets are gifts that offer investors a chance to buy the stocks of competitively advantaged companies at great prices. Doing so can lead to unbelievable long-term results. Here's a look at two stocks that could lead the market recovery.

1. Speaking of Warren Buffett, he's been buying Apple

Apple (AAPL -0.57%) is an excellent example of a competitively advantaged company whose stock went on sale during the 2009 bear market. At the bottom of the market, Apple stock closed at $2.97 per share (adjusted for stock splits). Had you bought about $1,000 worth of the stock, you would've received 336 shares. At the time of this writing, 4,949 days later (about 13 1/2 years), Apple stock has vaulted by 4,984% to $151, and your $1,000 would be worth $50,736.

The incredible gain doesn't even count the $2,207.40 in dividends you would have received. The dividends alone would have doubled your $1,000 investment and then some.

Is Apple stock still a buy right now? Warren Buffett thinks so. His company, Berkshire Hathaway (BRK.A 0.64%) (BRK.B 0.54%), has been a shareholder since 2016 and bought more shares in the first and second quarters of this year. Buffett thinks Apple is one of the best companies in the world.

Three family members using their smartphones together.

Image source: Getty Images.

Apple's iPhone is one of the world's most popular smartphones. It has about 50% of the U.S. smartphone market. But the company's rapidly expanding services segment probably also attracted Buffett. iPhone users can download music from the Apple Music app, make contactless payments with Apple Pay, and store their photos in the iCloud. These services are growing by leaps and bounds, and the segment has become more profitable as it grows.

In 2017, when Apple first disclosed the data, its services segment generated $32.7 billion in revenue. By 2021, services revenue had grown by 109% to $68.4 billion.

More important are profits. Apple's services are digital, so it costs the company very little to add new customers or for existing customers to add new services. Gross margin from services was 55% in 2017, and by 2021, the gross margin from the services segment had jumped to nearly 70%. That's more than the 35.7% gross margin from products like iPhones, Macs, and iPads. In dollar terms, the gross margin from the services segment rose 165% from $17.9 billion in 2017 to $47.7 billion in 2019.

Apple is looking to expand its services segment in the long run. Contactless payments systems like Apple Pay have increased dramatically due to the pandemic.

Apple Pay recently surpassed payment giant Mastercard in transaction volume. As iPhone users continue accumulating selfies and downloading the newest music, iCloud and Apple Music can also expand. And AppleTV looks to build on its successful launch of Ted Lasso.

What's most important to investors is that the stock dropped 17% this year and trades at a price-to-earnings ratio of under 25 times. Buffett was a buyer in the first two quarters of the year, and the bear market is now offering investors an opportunity to buy Apple at a similar value to his buys this year.

2. EV growth means big business for Copart

Copart's (CPRT -1.52%) dull business will get significantly more exciting in the years to come. The company is a reseller of damaged cars. Its primary sources of damaged vehicles are insurance companies, which deem a damaged car a "total loss" when it costs more to repair than to pay a claim. They rely on Copart's digital salvage business to file the necessary paperwork quickly and sell the car to dealers who salvage the vehicle for its parts.

Copart's online auction platform allows buyers to access thousands of vehicles from the company's network. The buyers are primarily dismantlers that refurbish undamaged parts and resell them. Rebuilders and used car dealers also buy and repair cars at a lower cost than the insurance companies can and resell them. Copart keeps a percentage of the sales price for itself.

Person happily driving their new car.

Image source: Getty Images.

Copart was one of the first auto salvage companies to introduce an online auction platform. It reduced the time and money insurance companies must spend on selling and filing total-loss claims. More importantly, though, the platform sells salvage cars within seven days. Buyers can get deals done faster, and insurance companies can get paid faster.

The company's first-mover advantage with its auction platform allowed it to grow its market share from slower-moving physical-site auction companies. The platform also enables Copart to acquire smaller auction competitors, plug them into its platform, and quickly scale them up. The results have been tremendous.

Over the last decade, Copart has increased its revenue by 208.7%, from $872.2 million in 2011 to $2.69 billion. Due to the scale advantage of its online platform, net income grew even faster over that time, from $166.3 million to $936.5 million or 463%. More impressively, the stock closed at $11.97 at the end of 2011 and increased by 1,167% to $151.62 by the end of 2021. But electric vehicles (EVs) will change the game.

EVs are equipped with cameras, microprocessors, and perimeter sensors. Many of those instruments make the vehicles safer, but the repair costs are significantly higher. That means insurance companies deem EV total losses at a higher frequency than other cars. Though the EV market is still in its early stages, buyers have found that they're making more money on EV salvages. As the EV market continues to gain steam over the next several years, more buyers and sellers should benefit Copart handsomely.

If you missed Copart stock over the last decade, today's bear market is giving you another chance. The company has shed $14.38 billion in market cap since the beginning of the year and trades at a price-to-earnings ratio of 23.7 times. Outside of the COVID-19 bear market in March of 2020, the stock hasn't traded at a valuation that attractive since 2017.

Invest now or wait?

The bear market is giving investors a chance to buy shares of great companies at low prices. We don't know when a bull market will sweep in and carry stocks higher, but it will. Buying stocks now will take patience and the fortitude not to sell until the recovery is in full force, but it can generously reward steadfast investors in the long run. They might seriously regret waiting.