Warren Buffett knows a thing or two about inflation. The legendary investor has lived through periods where inflation was even higher than it is now. At the Berkshire Hathaway (BRK.A 0.36%) (BRK.B 0.21%) annual shareholder meeting in April, he spoke directly about inflation, stating that it "swindles almost everybody." 

It's not surprising, therefore, that the Oracle of Omaha has invested in some stocks that are built to hold up well even with consumer prices rising significantly. Here are three Buffett stocks to buy that are practically inflation-proof.

1. Chevron

Buffett has backed up the truck and loaded up on Chevron (CVX 0.08%). Since the fourth quarter of 2021, Berkshire has more than quadrupled its stake in the oil and gas giant. Chevron now ranks as one of the largest holdings in Berkshire's portfolio.

Buying Chevron has turned out to be a shrewd move. The stock is one of Buffett's best performers so far this year, with shares jumping more than 30% while the major market indexes have plunged.

The primary reason behind rising inflation right now is high fuel costs. But Chevron directly benefits from the higher oil and gas prices. Its sales soared nearly 67% year over year in the first quarter, with profits rising almost fivefold.

Sure, the current market dynamics won't always serve as a major tailwind for Chevron. However, the company appears to be well-positioned for years to come -- regardless of whether inflation remains a problem.

2. McKesson

Of the eight new stocks Berkshire bought in the first quarter, McKesson (MCK -0.46%) is arguably one of the best. The healthcare services company certainly claims one of the strongest and most resilient underlying businesses.

Those characteristics have been especially attractive to investors given the current economic uncertainty. McKesson's shares have vaulted more than 20% higher year to date, making it one of Buffett's best-performing stocks of 2022 so far.

McKesson cautioned in its fiscal 2022 Q4 earnings press release in May that it "might be adversely impacted by inflation." However, CEO Brian Tyler nonetheless noted in the quarterly update that the company doesn't expect a big headwind from inflation in the coming year. McKesson should be able to pass along any higher prices it incurs to customers.

The stock remains attractively valued despite its strong performance this year. Shares trade at a little over 13 times expected earnings. McKesson also appears to be in a good position to continue delivering solid double-digit-percentage revenue and earnings growth over the next several years.

3. Markel

Buffett wrote in his most recent letter to Berkshire Hathaway shareholders, "The insurance business is made to order for Berkshire. The product will never be obsolete, and sales volume will generally increase along with both economic growth and inflation." He was referring to Berkshire's fully owned insurance businesses, but his comments apply equally well to Markel (MKL 0.34%)

Some people refer to Markel as a "baby Berkshire." The nickname is well deserved. Like Berkshire, Markel is in the insurance business. Also like Berkshire, it invests in other publicly traded companies. Markel's largest holding, by the way, is none other than Berkshire itself.

Insurance stocks aren't automatically immune to the effects of inflation. However, well-run companies such as Markel are typically adept at staying ahead of it. Markel co-CEO Richie Whitt noted in the Q1 conference call that the company is "baking more claims inflation into both our pricing and reserving and believe rate increases remain ahead of claims inflation."

Markel's investment portfolio does have more exposure to inflation. But the company's core business should enable the stock to fare relatively well compared to the overall stock market.