It's been a tough year for Ally Financial (ALLY -2.44%) as rising interest rates and slowing consumer demand for automotive loans hit its business. Ally is down nearly 48% since the start of the year and trades at a discount to book value, but that hasn't stopped Warren Buffett and Berkshire Hathaway (BRK.A -0.33%) (BRK.B -0.38%) from building a position in the digital bank.

Berkshire Hathaway initiated a position in Ally Financial in the first quarter and has since acquired a 9% ownership stake. Buffett is known for using a margin of safety when making investment decisions, making Ally Financial an ideal Berkshire Hathaway investment. Here's why.

Ally's business is highly dependent on automotive lending conditions

While the bank has worked to expand its offerings to customers, including Ally Invest, Ally Credit Card, and Ally Lending, it still relies heavily on automotive lending as a big chunk of its business. This year Ally generated $4.1 billion in revenue through its automotive finance business, or 66% of its total revenue. For this reason, the bank is highly sensitive to changes in the automotive lending landscape.

Pandemic-related supply chain issues, including a shortage of computer chips, affected automotive production in the last few years. As a result, used cars were hard to come by, and their costs skyrocketed.

According to the Manheim Used Vehicle Value Index, the cost of used cars in January was up nearly 67% compared to January 2020. These elevated prices helped Ally's business originate larger loans per car sold. In the second quarter, the bank originated $13.3 billion in auto loans -- its highest quarter of originations since 2006. 

Vehicle prices have since dropped -- a good thing for consumers, but not necessarily a great thing for Ally. Used car prices are down nearly 16% from their peak in January, and a more challenging economic backdrop is taking a toll on Ally's business. In the second quarter, originations dropped 7.5% to $12.3 billion, and investors also seemed concerned about its deteriorating loan quality. In the third quarter, its net charge-offs of 0.85% were up from 0.49% in the prior quarter.

Chart showing Ally Financial's net charge-offs on auto loans rising over the last five quarters.

Image source: Ally Financial.

How Ally's valuation gives Buffett a margin of safety

Margin of safety is a principle used by Warren Buffett that says you should only invest in stocks when their market price is far below their intrinsic value. By investing with a margin of safety, you are setting yourself up to make investments with limited downside potential. A company's book value is one way to measure a stock's intrinsic value, which you can use to determine its margin of safety.

Declining car values, falling originations, and increasing charge-offs have Ally stock down 45% since the start of the year -- and at a dirt cheap valuation, with an 18% discount to its book value. It's also cheap in other measures, including its price-to-sales (P/S) and price-to-earnings (P/E), which have the bank stock near its lowest valuation since going public in 2014.

Charts showing Ally's PS and PE ratios, and price to tangible book value, falling since 2021.

Data by YCharts.

A great value stock for long-term investors

Ally Bank faces headwinds in the short term, which have weighed heavily on its stock price. Management expects fourth-quarter originations of $10.8 billion, which would represent a decline of 12% from the third quarter. It also expects an uptick in the net charge-off ratio, which management believes will peak around 1.6%.

However, Warren Buffett is playing the long game and looking past these short-term effects. The bank benefits from higher interest rates, with new loans producing up to 9% interest. It's also steadily growing its consumer banking business and recently completed its 54th consecutive quarter of increasing customer deposits. 

The bank is in a solid financial position too. Its CET1 ratio, a regulatory ratio for banks measuring core capital divided by risk-weighted assets, is 9.3% and well above the Federal Reserve's minimum ratio of 7% -- giving it $3.6 billion in excess capital. It has put its cash to work, rewarding investors with a 4.8% dividend yield and another $1.6 billion on buying back its stock this year.

Given Ally's dirt-cheap valuation, it's not too surprising that Warren Buffett has taken an interest in the bank. Buffett is in it for the long haul, and its cheap valuation gives it a margin of safety, which should provide investors with solid upside potential and limited downside risk.