All three major stock market averages are firmly in bear market territory, and this has created many bargains for patient long-term investors. One part of the stock market that is full of particularly attractive opportunities right now is the financial sector.

Ally Financial (ALLY -0.43%) is a financial stock many investors aren't too familiar with, but the innovative and fast-growing bank looks like an incredibly cheap but solid investment from a long-term perspective.

Ally is a highly profitable fintech company

Ally is an online-based bank that offers a full range of loans, deposit products, brokerage services, and more, with a specialization in auto loans and high-yield savings accounts. Prior to the financial crisis, Ally was General Motors' banking subsidiary -- hence the focus on auto loans. In fact, Ally is the largest prime auto lender in the U.S., with about $106 billion in outstanding auto loan and lease balances.

Ally originated $13.3 billion in auto loans during the second quarter alone, the bank's highest volume in more than 15 years. It has an insurance business to complement its auto lending, more than $130 billion in customer deposits, a brokerage business with $13.5 billion in assets, a fast-growing corporate finance business, and more. More than 10 million customers use Ally for at least one banking product, and Ally is the largest all-digital bank in the United States.

Ally Financial is a highly profitable and efficient business. It benefits from the relatively high interest rates of auto loans, as well as the low cost of capital that comes from its large deposit base and online-based model. In fact, the average auto loan Ally originated in the second quarter has a 7.8% yield and the bank paid just 0.76% in interest on its massive deposit base. Even if you include a 2% to 3% loan loss rate, this is still an impressive spread.

The next few quarters could be ugly, as a slowdown in consumer spending, ongoing supply chain issues in the auto industry, and fears of a looming recession could certainly cause loan volumes to decline and defaults to tick upward. But this is a solid business that has a margin of safety during tough times.

A fire-sale valuation

While there could certainly be a pullback in loan volume and an uptick in loan delinquencies, the bad news appears to be largely priced into the stock at this point. Ally's business generated $7.97 per share in adjusted earnings over the past four quarters, giving it a staggering 3.6 price-to-earnings ratio. It trades for a multiple of just 0.76 times its book value, far below many of its larger peers that don't have the same beneficial cost structure. Ally is also well capitalized, with plenty of loan-loss reserves and capital ratios that are well in excess of regulatory requirements.

Plus, Ally could actually benefit from the rising-rate environment, and that's already starting to show in the numbers. The bank's average auto loan interest rate increased by 75 basis points from the first quarter of 2022 to the second and will likely continue to rise when Ally releases its latest results in a few weeks.

Ally also has done a fantastic job of returning capital to investors. It has increased its dividend at least annually since 2016, and currently yields about 4.2%. Its share repurchase efforts have been even more impressive, with the bank reducing its share count by 35% over the past six years and spending $1.2 billion on buybacks in the first half of 2022 alone -- a very aggressive pace for a company whose entire market cap is less than $9 billion.

A great income and growth stock, but be patient

Ally looks incredibly attractive from a long-term perspective. Even with the possibility of a few ugly quarters to come, the bank should remain profitable, and the long-term economics look fantastic. Plus, the prioritization of returning capital is impressive, especially when it comes to buybacks.

However, it's wise to expect quite a bit of near-term volatility. The auto lending business is a rather cyclical business and while recession fears are high, inflation persists, and the auto industry remains challenged by supply chain problems, the stock will likely take investors on a bit of a roller-coaster ride. But for those willing to wait, it could be a long-term home run, and that's why I plan to continue building my position in Ally at these levels.