Ally Financial (ALLY 0.57%) is getting hit hard by worsening credit conditions in the automotive market and rising interest rates. At Wednesday's closing price, the auto lender's stock was down 43% this year, more than double the nearly 20% drop for the S&P 500.

Yet even with the short-term earnings pressure, now could be a great time to scoop up some shares of Ally Financial if you have a multiyear time horizon. Here's why.

Q3 earnings: The good and the bad

Ally's third-quarter earnings, announced earlier this month, were below average at best. The company's net income was $272 million in the period, down from $683 million in the same quarter last year. Why did earnings drop so quickly? There's one main reason.

With the Federal Reserve sharply raising interest rates, Ally has raised the rate its pays depositors to hold money at the bank. Ally makes money by lending out these deposits for car loans and other lending products, which typically have a fixed rate over multiple years. So when it's forced to raise the interest rate it pays consumers, the spread it earns on the interest it pays versus the interest it receives narrows. This is called net interest margin (NIM). Management is guiding for NIM to decline to 3.5% over the next few quarters. That will affect earnings until its automotive loan book gets repriced to higher interest rates, which will rewiden the spread.

Another thing worrying investors is the current sharp decline in used car prices in the United States. The majority of Ally's automotive loans are for used cars, and if prices keep declining, its loan volume could decrease. On top of this, the value of the cars it repossesses from people who default on its loans will decrease, which hurts its earnings power.

Ally's automotive lending business is about to head into a rough patch, but the other side of its business, consumer banking, is doing just fine. Customers grew for the 54th consecutive quarter to 2.6 million, with retail deposits hitting $133.9 billion, up $2.7 billion from last quarter and $2.3 billion from the third quarter of last year.

Ally is also steadily cross-selling new products to its consumer banking customers. For example, Ally Credit Card now has a total balance of $1.4 billion, up from $0.8 billion last year.  

The consumer banking side of Ally's business is vital, as it gives the company low-cost deposits to fund its lending operations. With consumer deposits steadily marching higher, there's no reason to think Ally's earnings won't return to an upward trajectory once interest rates and used car prices stabilize. 

Take the long view

If you're an investor in Ally, you have the right to be concerned about what could happen to its earnings over the next few quarters. But over the long term, the company looks set to succeed and return plenty of value to shareholders at these prices.

At recent prices, with a market cap of roughly $8 billion, Ally is trading for less than its book value, an important metric for a bank stock. Over the long term, management thinks it can return 16% to 18% annually on this book value due to its low-cost deposits and zero-branch model, which could lead to investors yielding more than that each year in earnings if shares are bought below book value.

However, over the next few quarters this return, known as return on equity (ROE), will be lower. In Q3, it was only 10%. This isn't a bad ROE, but is lower than what management thinks Ally can generate in a normal macroeconomic environment.

ALLY Average Diluted Shares Outstanding (Quarterly) Chart

ALLY Average Diluted Shares Outstanding (Quarterly) data by YCharts

The company is also generous with the cash it returns to shareholders. Its dividend currently yields almost 4.5%, and it's bought back more than 35% of its outstanding shares since going public in 2014. Both could bump returns even higher over the next five or so years.