Warren Buffett hasn't seen a lot to like in the stock market in 2023, but there's one stock he keeps buying.

The Oracle of Omaha has been a net seller of stocks through the first nine months of the year. Total equity sales for Berkshire Hathaway came to $32.8 billion as of the end of September, while stock purchases totaled just $9.1 billion during the period. On top of that, Buffett sold about $1.3 billion of HP stock so far this quarter, continuing to sell off Berkshire's stake in the company.

But recent SEC filings indicate Buffett has been adding to one of his top holdings: Occidental Petroleum (OXY -0.15%). He purchased 10.5 million shares of the oil company last week for about $589 million. That brings Berkshire's total stake in Occidental to 27.2%, and it still holds an additional $8.5 billion in preferred shares and warrants.

Close-up of Warren Buffett's face.

Image source: The Motley Fool.

The latest purchase follows news that Occidental will acquire CrownRock for $12 billion, giving investors confidence in Buffett's outlook for the deal. Additionally, Occidental is quickly becoming Buffett's favorite energy stock, as he's been selling off Berkshire's shares of Chevron (CVX 0.37%) this year.

Buffett's shifting energy investment

Berkshire Hathaway tied itself to Occidental when it provided $10 billion in capital related to its 2019 Anadarko acquisition. In exchange, Berkshire received 100,000 preferred shares of Occidental, which pay an 8% dividend.

Occidental's balance sheet took a major blow after the Anadarko acquisition. Not only did it arguably overpay for the assets after a bidding war with Chevron, it also got hit with the huge challenge of COVID-19 (when oil prices crashed). It suspended its dividend as it looked to conserve cash any way possible.

Buffett had established a position in Occidental's common stock in 2019 as well, but sold the entire holding at the onset of the pandemic at a severe loss. He didn't start buying up the common stock again until March 2022, after Russia invaded Ukraine. And he bet big. He snatched up 136 million shares in the first quarter of the year, and he's purchased more shares in five of the seven quarters since (including the current one).

Meanwhile, Buffett has soured on Chevron. While he also made a big bet on the energy company in Q1 of 2022, he's sold off shares for four straight quarters. Chevron remains Berkshire's largest holding in the energy space, but Occidental is starting to close in on it. And if the trend continues, it won't be long until it overtakes Chevron.

Why is Buffett selling Chevron and buying Occidental?

There could be any number of reasons Buffett's selling Chevron shares in favor of Occidental. One simple explanation may be that he likes the valuation of Occidental better. That said, the EV/EBITDA ratio for the two companies is close. Chevron shares trade for a multiple of 5.7 versus Occidental's 5.2.

The disparity in price to free cash flow is much more pronounced. Chevron trades for 14 time free cash flow while Occidental trades for 8.3. But it's important to remember that excess cash generated by Occidental is required to pay the 8% dividend on Berkshire's preferred shares while buying back as much of that position as reasonable on top of its existing dividend obligation to common stock shareholders.

An oil well at sunset.

Image source: Getty Images.

Meanwhile, Occidental's move to buy CrownRock for $12 billion, which will be largely funded with debt, will put further pressure on its free cash flow. While the company expects to sell off certain assets and use the additional cash flow to quickly pay down that debt, it still makes the acquisition risky. Management says the acquisition will generate $1 billion in additional cash flow as long as oil prices remain above $70 per barrel. That's not a lot of wiggle room from today's price in the low $70s.

As such, Occidental is a much riskier investment than Chevron. That said, the upside could be far higher if its increasingly strong position in the Permian basin, bolstered by the CrownRock acquisition, works out. Buffett has said he likes the company's position in the West Texas region.

Importantly, Occidental's management has shown the ability to weather a rough patch, as seen in 2020. And Buffett has expressed a lot of confidence in the leadership team, noting that current CEO Vicki Hollub "is an extraordinary manager of Occidental." So if you have similar confidence in Occidental and its management, it may be worth taking a position in one of the riskier oil companies in the market.