In Berkshire Hathaway's (NYSE: BRK-A)(NYSE: BRK-B) 2011 letter to shareholders, Warren Buffett wrote, "'Buy commodities, sell brands' has long been a formula for business success." Hershey (NYSE: HSY) has followed that formula for years: buying sugar and cocoa and selling Hershey's, Reese's, Kit Kat, and other American favorites in the candy aisle.

Buffett explains how good Hershey's business is in a 1991 speech at Notre Dame:

If you walk into a drugstore, and you say 'I'd like a Hershey bar' and the man says 'I don't have any Hershey bars, but I've got this unmarked chocolate bar, and it's a nickel cheaper than a Hershey bar,' you just go across the street and buy a Hershey bar. That is a good business.

When people buy chocolate, they do not buy the cheapest brand. They buy the best brand. It does not matter how many knock-offs are on the shelf next to it; most people who want a chocolate bar are going to buy a Hershey's bar.

But do not take my word for it, look at the data: Hershey has the leading share of its core market.

Source: The Hershey Company

The only company that comes close to matching Hershey in the U.S. is Mars -- the company that Berkshire Hathaway helped to finance in the 2008 acquisition of Wrigley. But even Mars has just a 30% share of the U.S. chocolate market compared to Hershey's 44% share.

Wrigley, in which Berkshire Hathaway maintains a minority interest, has an overwhelming 58% share of the U.S. gum market -- a market that Hershey largely ignores. Moreover, Wrigley generates most of its sales outside of the U.S., making it less of a threat to Hershey.

Mars and Nestle (ADR) (NASDAQOTH: NSRGY) are Hershey's primary competitive threats in the United States, where Hershey generates close to 85% of its sales. Though private labels are unable to attract a significant following among brand-conscious consumers, other brands offer substitutes. For instance, Mars's M&Ms may be substituted for Reese's Pieces.

Nestle is launching a direct competitor to Reese's Peanut Butter Cups. Just about the only thing that can compete with a well-known American brand is another well-known American brand.

Nestle's Butterfinger Peanut Butter Cups will be available in stores starting January 2014 and will be featured in a Super Bowl commercial in February. According to a Nestle spokesperson, it will be the first time that Nestle USA has run a Super Bowl commercial -- signaling that the company is planning to mount a significant challenge to Reese's cups.

But even if Nestle adds to its measly 6% share of the U.S. chocolate market via its Butterfinger Cups roll-out, it is unlikely that Americans will ditch Reese's Cups en masse; the Reese's Cups brand has too much mind share for consumers to suddenly start buying another brand. This is part of what makes Hershey a wonderful business -- its combination of sugar and cocoa can sell at a higher price than Nestle's combination simply because of the branding.

Long-term value creation
Due to its enormous market share and leading brands, Hershey earns higher returns on invested capital, or ROIC, than most businesses. If you divide the company's after-tax operating profit by its average invested capital, you find that the company earns an ROIC in excess of 15% on average.

Source: Hershey

This means that for each dollar Hershey invests in expanding or maintaining its business, the company earns more than $0.15 in after-tax profits each year. If you earned a 15% after-tax return on your stock portfolio each year, you would be pretty happy with the results. That is essentially what Hershey earns -- and that's why it is a wonderful business.

Moreover, Hershey compounds the effect by continually lowering its share count. Although the company has not repurchased a significant number of shares since the financial crisis, the long-term trend shows that Hershey is devoted to reducing the share count over time.

Source: Hershey 

The combination of high returns on invested capital and shareholder-friendly management has enriched shareholders over the last two decades.

HSY Chart

Hershey data by YCharts

Bottom line
Hershey has a leading (and growing) share of the U.S. chocolate market; its portfolio of brands is more popular among Americans than any other company's brands. This enables it to charge higher prices than competitors, which in turn enables it to earn high returns on invested capital.

Hershey is not untouchable. Nestle and Mars can compete with it in many markets within the United States. Even much smaller companies, like Berkshire Hathaway's See's Candies, have a larger share of select markets than Hershey.

But Hershey will continue to earn out-sized profits as long as Americans care more about the brand they buy than the price of the sugar-and-cocoa combination. This has held true in the 119 years since Hershey opened its doors, and there is little reason to believe it will not be true for the next 119 years.

3 wonderful businesses -- with dividends!
If you're looking for some long-term investing ideas, you're invited to check out The Motley Fool's brand-new special report, "The 3 Dow Stocks Dividend Investors Need." It's absolutely free, so simply click here now and get your copy today.

Ted Cooper has no position in any stocks mentioned. The Motley Fool recommends Berkshire Hathaway. The Motley Fool owns shares of Berkshire Hathaway. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.