Warren Buffett is a proponent of long-term investing and has popularized the concept for many individual investors. The longest-held equity position currently in Berkshire Hathaway's (BRK.A 0.59%) (BRK.B 0.53%) portfolio is Coca-Cola (KO 0.48%). Its 9.2% stake in the beverage giant is its third-largest position, and accounts for 7% of the conglomerate's stock holdings.

Coca-Cola is a classic Buffett stock. The company has a wide competitive moat and excellent cash generation, it's a Dividend King, and it typically trades at a low valuation.

These qualities become even more attractive in a stock at times when inflation is high and the market is falling -- times, for example, like now. But what we can learn from this top Buffett pick about investing during periods of high inflation?

High inflation, too, shall pass

The first thing to note about Buffett's investing style is that it's long-term focused. When you invest with that mindset, you need to prepare for the tough times and the good times.

So only focusing on high-growth companies is an approach that's almost doomed to failure. Recognizing that there are going to be periods of economic uncertainty, periods of slow economic growth, and periods of high inflation should inform your investing decisions even when stock prices are flying high.

In fact, those should be the times you would want to be most cautious. Buffett's most cited quote is probably, "We simply attempt to be fearful when others are greedy, and to be greedy only when others are fearful."

Another of his famous quips is that "our favorite holding period is forever." If you invest in high-quality companies that can withstand the challenging periods, they should reward you over time. And the longer you hold them, the bigger the rewards are likely to be.

Many investors know about the "holding period" line, but they may not know that it was delivered specifically in regards to two stock purchases Berkshire Hathaway made in 1988 -- and one of them was Coca-Cola. In his 1989 shareholder letter, he said of those stocks, "We expect to hold these securities  for a long time. In fact, when we own portions of outstanding businesses with outstanding managements, our favorite holding period is forever."

Which qualities does Buffett see as crucial for a company when there's significant inflation? The most important would probably be cash generation. And that's where Coca-Cola is a star.

A strong cash position is an indication of a strong business

Strong fundamentals are the key to maintaining a viable business, and those start with cash generation. Coca-Cola has been able to maintain its large cash stockpile through strong sales, which continued into 2022's third quarter despite inflation. Revenue increased 10% over last year, without major capital investments. That fueled free cash flow, which came in at $7.4 billion.

Coca-Cola enjoys strong free cash flow at any given time and demonstrated this over many years.

KO Free Cash Flow Chart

KO Free Cash Flow data by YCharts

That's where the dividend comes in

Companies that pay dividends are typically mature, past their high-growth stages, and focused on shareholder value. Coca-Cola has raised its dividend for 60 years consecutively, which is one of the best track records on the market. It is about as solid as you can get for a dividend, and it yields 3.15% at the current price, right around where it usually falls.

It has a high payout ratio of 78%, which demonstrates both its tremendous cash reserves and commitment to shareholders, but it also leaves management with enough funds to run the business and innovate

Building the moat

Buffett said many times over the years that the companies that perform the best when inflation is running hot are the ones that don't require high levels of capital investment.

Coca-Cola built out its distribution network over many decades and enjoys strong brand awareness and pricing power. It doesn't need to consume the cash it brings in to keep its motor running, so it's comparatively impervious to inflation and cost changes. The company certainly impacted by those issues, but it's not sweating them.

Buffett also used Coca-Cola as an example of an excellent company to hold in high-inflation periods since it has pricing power. At the 2009 Berkshire Hathaway annual meeting, he said that his first recommendation for protecting yourself against the impacts of inflation is to invest in yourself. He followed that advice with this:

The second best protection is a wonderful business. You know, if you own the Coca-Cola ... Company, you will get a given portion of people's labor 20 years from now and 50 years from now for your product. And it doesn't make any difference what's happened to the price level, generally. Because people will give up three minutes of labor, whatever it may be, to enjoy, you know, 12 ounces, you know, of a product they like.

And as Coca-Cola CEO James Quincey noted on the third-quarter 2022 conference call, the company's well-loved brands are powering its resilience in this tough economy.

The stability of a steady valuation

Coca-Cola carries a price-to-earnings ratio of 27 at the current share price. That doesn't look particularly cheap in this market, where valuations broadly have fallen off a cliff. But if you look at this multiple over time, it doesn't change much. (Save for the end of 2017, when Coke posted a loss per share related to conditions at the time, sending the PE ratio temporarily higher.) 

Two years ago, when many prices were bloated and valuations were astronomical, it still traded at a similar price-to-earnings ratio to the current multiple, indicating that investors see it as a value play.

KO PE Ratio Chart

KO PE Ratio data by YCharts

Investors know that Coca-Cola's business is slow and steady, and through thick and thin, it performs. That's a function of everything mentioned above, and the reason its valuation is maintained at this level.

That's not to say that every stock you own should be like Coca-Cola. But a properly diversified portfolio should have some value plays that can cushion you when the market plummets, and Coca-Cola is a great pick to provide that stability and passive income.