One secret of successful investing is price. Sell dear enough or buy cheap enough, and you can make money even if the market moves against you.

Today’s example involves Warren Buffett, who got the markets for both junk bonds and GE stock wrong — but has made money on both anyway.

In his letter to shareholders of his Berkshire Hathaway conglomerate, one of whom is me, Buffett (a director of The Washington Post Co.) talks about the company’s adventures — or misadventures — in the junk bond biz. Berkshire, he says, had sold contracts requiring it to pay if certain junk bond issuers defaulted. Because of the financial panic and severe recession, more issuers than expected croaked, and Berkshire had to pay the contract holders $2.5 billion.

However, Buffett predicts Berkshire will come out ahead, even though some of its contracts are still in force. The reason: “We charged the right premium, and that protected us when business conditions turned terrible three years ago.”

The same right-price principle holds with Berkshire’s investment in GE, which he didn’t discuss in his shareholder letter but is a fine example of how you can make money if you buy cheap enough.

GE is selling below what it fetched in October 2008, when Buffett made his famous deal to buy $3 billion of GE stock and GE also sold $12 billion of new stock to public investors. Investors who bought in the public offering are behind, but Berkshire is way ahead on its investment.

That’s because Buffett got to buy cheap.

GE, which at the time was reeling from fallout caused by the Lehman bankruptcy, badly wanted Buffett’s imprimatur. So Buffett didn’t buy $3 billion of common stock at GE’s then-market price of $22.25, as public investors did. Rather, Berkshire bought $3 billion of preferred stock that carries a fat 10 percent annual dividend, and also got a warrant that carries the right (but not the obligation) to buy $3 billion of GE common at $22.25 through October 2013.

If you bought common stock for $22.25 the day the deal was announced, you own shares that closed Monday at $20.42. Even with the $1.52 of dividends you’ve collected since the offering, you’re behind.

By contrast, Berkshire has gotten preferred stock dividends equivalent to about $5.40 a GE share. If you count the premium it’s almost certain to get in October, when GE can redeem the preferred for $3.3 billion, Berkshire has so far made about 35 percent in dividends and capital gains on its $3 billion investment, compared with a slight loss for investors who bought at the public offering on Oct. 7, 2008.

In short, Buffett’s return — assuming GE buys him out in October — has about matched the Standard & Poor’s 500 return since the offering, while other GE holders have lagged it badly.

What’s more, Berkshire still owns the aforementioned stock-purchase warrant giving it the right to buy $3 billion of GE common stock at $22.25 through October 2013. GE valued the warrant at $500 million when it was issued; it’s now worth about $150 million, by my estimate. But even if the warrant expires worthless, Berkshire is way ahead on its total investment.

Neither GE nor Buffett would discuss their deal. But I’ve been watching Buffett for about 35 years, and I doubt he was betting on GE common stock selling at less today than when he made his deal. He was just building a margin of safety into Berkshire’s investment, which is what he tries to do.

You’ve got to love it. In the junk bond market, Buffett sold insurance at a dear price. In the GE market, he bought stock at a cheap price. He didn’t get either market right, but he’ll still come out ahead. This, my friends, shows why he’s Warren Buffett. And we’re not.

Allan Sloan is Fortune magazine’s senior editor at large.