Since Warren Buffett took the helm at Berkshire Hathaway (BRK.A -0.76%) (BRK.B -0.69%) nearly 60 years ago, the stock has nearly doubled the total return achieved by the S&P 500. Last year, however, Buffett didn't beat the market.

That doesn't mean he didn't have some big winners in Berkshire's portfolio, though. There's one stock in particular that Buffett bought in mid-2023 that he probably wishes he had purchased sooner.

The second-best Buffett stock of 2023

Buffett didn't buy many stocks last year. Actually, he was a net seller during the year. However, he really liked one group of stocks.

In the second quarter, the legendary investor initiated new positions for Berkshire in three homebuilders. His biggest stake of the three was and is in D.R. Horton (DHI 0.78%).

D.R. Horton ranks as the largest homebuilder by volume in the U.S. It has held that distinction since 2002. The company operates in 118 markets in 33 states, typically building homes ranging in price from $200,000 to over $1 million. It also builds single-family and multifamily rental properties.

Buffett only buys a stock when it passes a two-step test. First, he must be able to reasonably estimate the future earnings over the next five years or more. Second, the stock's valuation must look attractive compared to the lower end of the projected earnings range. D.R. Horton obviously passed this test, since Berkshire scooped up nearly 6 million shares.

We don't know exactly how big of a gain D.R. Horton delivered for Buffett last year because we don't know exactly when he bought the stock. However, had the homebuilder been in Berkshire's portfolio for the full year, it would have been the conglomerate's second-best stock of 2023. Only Amazon generated a greater gain.

More good news likely on the way for D.R. Horton

In D.R. Horton's third-quarter earnings conference call, CEO David Auld said, "Despite continued high mortgage rates and inflationary pressures, our net sales orders increased 37% from the prior-year quarter, as the supply of both new homes and existing homes at affordable price points is limited and demographics supporting housing demand remain favorable." The good news for the company is that the headwinds Auld mentioned probably won't be as problematic in 2024.

Mortgage rates have already come down somewhat since D.R. Horton's Q3 call. The Federal Reserve has also indicated that interest rate cuts could be on the way later this year. If so, mortgage rates should decline even further.

Inflation is also moderating. The Fed predicts that the core personal consumption expenditures price index will fall to 2.4% in 2024, much better than the inflation levels we've seen over the last couple of years.

The supply-demand imbalance that Auld referenced hasn't been resolved, either. An analysis published by Bank of America in the fall of 2023 estimated that the U.S. has a shortage of around 4 million homes. In December, another BofA report revealed that fewer prospective homebuyers are willing to wait for a better market environment to buy a new home.

Still a no-brainer stock to buy

All these factors point to strong demand for the homes that D.R. Horton will build. And that number is likely to grow in 2024. Auld stated in the Q3 call that his company plans to incrementally increase how many new homes it begins building each quarter.

After shares skyrocketed 70% last year, though, you might think that D.R. Horton could be too expensive, even with its tremendous growth prospects. That's not the case. The stock trades at only 11.2 times expected earnings. Its price-to-earnings-to-growth (PEG) ratio is an exceptionally low 0.64.

I wouldn't be the farm on D.R. Horton rising as much in 2024 as it did last year. However, this Buffett stock is still a no-brainer buy, in my view.