Warren Buffett has earned his reputation as one of the best investors in history, and millions of followers have benefited from the advice that he regularly shares both with investors in his Berkshire Hathaway (BRK.A 1.00%) (BRK.B 0.79%) as well as the general public.

The latest installment of Buffett's annual letter to Berkshire shareholders just came out, and in it, the Oracle of Omaha talked a lot about how the conglomerate has performed recently. Toward the end of the letter, Buffett shared some lessons about investment risk that he learned from an unusual bet that he made a decade ago. In particular, Buffett noted that many investors are making what he called a "terrible mistake" that could lead to the ultimate failure of their investment strategies.

Warren Buffett with cameras and others surrounding him.

Image source: The Motley Fool.

Buffett, bonds, and a big bet

In 2007, Buffett made a bet with hedge fund investors at Protege Partners. He believed that an unmanaged S&P 500 index fund would be able to outperform various combinations of funds that the hedge fund investors chose over the following 10 years. Protege took the other side of that bet. As it turned out, the S&P dramatically outperformed all five sets of hedge funds that Protege's designated managers chose, letting Buffett win the bet.

Yet the most interesting thing about the bet wasn't its result but rather the way a simple change resulted in the charity Buffett chose getting more than twice as large a donation as originally anticipated. To provide the planned $1 million prize to be donated to the winner's choice of charities, Buffett and Protege each bought zero coupon bonds that would be worth $500,000 at maturity 10 years in the future. When purchased, the bonds cost $318,250 and provided a yield to maturity of more than 4.5%.

About halfway into the decade in late 2012, the bond market saw yields hit unprecedented levels. By that time, the yield on the zero coupon bonds that Buffett and Protege held had fallen below 1%. That meant that the total value of the bonds had risen to $957,000 -- just $43,000 shy of the $1 million that would go to charity five years later.

A big(ger) win for Girls Inc. of Omaha

Buffett believed that this was a ridiculous situation, calling an investment in bonds with a yield of 0.88% to be "a really dumb" investment compared to American equities. Accordingly, the two parties both agreed to sell the bonds and instead invest in Berkshire stock.

Investors who've followed the stock market over the years already know what happened next. From 2012 to 2017, the stock market soared, and Berkshire shares climbed along with it. By the end of 2017 when the bet officially ended, the Berkshire stock that Buffett and Protege had bought with just under $1 million in 2012 was worth $2.22 million. Accordingly, Buffett's chosen charity -- Girls Inc. of Omaha -- got a supersized windfall.

Buffett's lesson about true risk

Buffett acknowledged that there was some risk involved in switching from Treasury bonds that many saw as "risk-free" to Berkshire stock. Yet with such a low threshold to overcome -- all Berkshire had to do was to return more than 0.88% -- Buffett and Protege agreed that the risk was largely limited to the potential that the stock market would happen to go through a period of weakness precisely at the end of the bet in late 2017. That didn't prove to be the case, and so the charity reaped greater rewards.

More broadly, Buffett emphasized that the whole point of investing is to forego consumption now in the hopes of allowing for greater consumption in the future. By that metric, just a 1% inflation rate would have crushed the Treasury bonds. Although stocks are admittedly riskier over periods of days, weeks, or even an entire year, they become less risky by Buffett's definition as time horizons lengthen.

Buffett's takeaway is that long-term investors make a terrible mistake when they say that a stock-heavy portfolio is "riskier" than a bond-heavy portfolio. Yet many sophisticated investment institutions, such as pension funds and college endowments, make this mistake regularly. If risk means guaranteeing growth, a long-term bond-heavy portfolio can have higher risk than one with a greater allocation to stocks.

As investors face another period of increased volatility in the stock market, the temptation to retreat to fixed-income investments that don't see the same level of day-to-day turbulence as stocks is strong. Resisting that temptation is essential to maximize your long-term returns and truly ensure financial security far into the future.