Stocks have underperformed to start the year. However, investing in the stock market can deliver stellar returns in the long run.

Over the past five years, the S&P 500 has returned 93%. While these returns are solid, three stocks that have crushed the market over the previous five years might surprise you. They're not in technology or cryptocurrency, but instead insurance and real estate lending -- not exactly where you would look for market-crushing returns.

Since 2017, Walker & Dunlop (WD 1.18%), Progressive (PGR -0.79%), and Kinsale Capital Group (KNSL 2.53%) have delivered outstanding returns of 200% or more -- and it doesn't look like they're slowing down anytime soon.

1. Walker & Dunlop: Up 565% the past five years

Walker & Dunlop competes in the $1.8 trillion multifamily lending market and currently services 6.5% of the total debt outstanding. It not only has a firm place in the multifamily market, but has also taken market share in it. In the past five years, multifamily loan originations have grown at 11.8% compounded annually, while Walker & Dunlops' origination market share grew from 5.2% to 9% in 2021. This was enough to make Walker & Dunlop the second-ranked multifamily lender behind only CBRE Group, according to data from Multi-Housing News.  

The company has achieved stellar growth, but it also has tailwinds working in its favor in the coming years. Chief Executive Officer Willy Walker has described a "wave of maturities" that will benefit Walker & Dunlop.

The multifamily market has prepayment protections, preventing borrowers from prepaying loans or refinancing loans in the middle of a loan, otherwise they'll face steep penalties. So while single-family borrowers are free to refinance at any time, multifamily borrowers face more restrictions on when they can refinance. Once loans on multifamily properties mature, borrowers can refinance loans without penalty. Because these commercial loans have shorter loan terms of two to 10 years, a balloon payment, or a large lump sum payment, for the remainder of the loan is usually required. Rather than making this balloon payment, many borrowers choose to refinance the loans at the end of their term. This is the "wave of maturities" that Walker talks about.

A chart from Walker & Dunlop shows multifamily loans that will be refinanced in the coming years.

Image source: Walker & Dunlop.

Hundreds of billions in multifamily loans will mature in the next five years, giving the company an excellent opportunity to continue its stellar growth. Eighty-nine percent of its future servicing fees are prepayment protected -- meaning it has a great chance to add more to its servicing portfolio while holding on to what it already has. Last year, 71% of refinancing volume was new loans, evidence that WD is taking a growing market share. Given its stellar growth, ambitious goals, and tailwinds from multifamily refinancings, Walker & Dunlop is a solid stock to own for the long haul. 

2. Progressive: Up 204% over the last five years

Insurance companies can perform well in various market conditions because insurance will always be in demand. People want to protect their property, and laws require people to hold insurance on their car or home. Because of this, insurance companies can be cash-generating machines. That's one reason Warren Buffett loves the industry so much.

During inflationary times, insurers can be good investment options because they have pricing power. When prices rise, insurers must increase premiums charged to customers, making them good inflationary hedges.

A downed tree in front of a house.

Image source: Getty Images.

When it comes to insurers, Progressive is one of the best. Last year the company faced higher losses, and its property business gave it the biggest headache, with Hurricane Ida causing $420 million in losses. Automotive insurance claims were up, too, as the frequency of personal auto accidents rose 14% while the severity increased 9%.

Rising inflation hurt the company, as the consumer price index hit the highest levels in 40 years. Last year the price of used cars was up 27%, affecting Progressive and other auto insurers. Net income declined 41.3% from 2020. But investors shouldn't fret.  

While the cost of repairing and replacing vehicles surprised Progressive, it reacted quickly and increased premiums charged as early as the second quarter. For the year, the insurer raised premiums 8% while also reducing expenses by eliminating less profitable policies.  

Combined ratio is a key metric in the insurance industry, which measures the claims costs plus expenses divided by premiums taken in. A ratio below 100% means a company is making a profit on the policies it writes. Progressive still put up a stellar 95.3% combined ratio despite rising costs (the lower this number the better). The company's skill in underwriting policies and adapting to the environment is why the insurer has written profitable policies for 21 years straight -- making this stock another stellar long-term performer.  

3. Kinsale Capital Group: Up 254% over the last five years

Kinsale Capital Group is a property and casualty insurer, but it specifically focuses on a type of coverage called excess and surplus (E&S). Excess and surplus is a type of specialty insurance that covers things traditional insurance doesn't cover.

Three people look over documents in a home.

Image source: Getty Images.

Kinsale focuses on high-risk individuals and small businesses -- and this unique type of insurance is growing faster than traditional policies. From 2011 to 2020, E&S markets grew 8.7% annually, while conventional property and casualty insurance grew 4.2%. As the market grows, so grow Kinsale's premiums. The insurer's gross written premiums have increased 36% compounded annually in the past four years. The company put up another stellar year of growth in 2021, and its written premiums rose 28% to $660 million. Net income also grew, increasing 73% from the year before to $153 million.  

Like Progressive, Kinsale can do well in an inflationary environment. While the company covers different risks, it has done a solid job of underwriting profitable policies. Last year Kinsale Capital put up a stellar combined ratio of 77.1% in 2021,  which was below its already solid five-year average of 83%. Kinsale has shown skill in writing policies on hard-to-place risks, and the market continues to reward it.