Photo: Mike Mozart, Flickr

If you're in the market for great stock ideas for your portfolio, it makes sense to study what the smartest and most successful investors own. There are few if any investors smarter or more successful than Warren Buffett, whose Berkshire Hathaway (BRK.A -0.28%) (BRK.B -0.68%) has averaged an annual gain topping 18% for 30 years. (That's enough to turn a single $1,000 investment into more than $140,000!) Costco Wholesale (COST 0.17%) is one of Buffett's largest stock holdings, so let's see if it's worth buying, too.

First off, though, understand that Berkshire Hathaway is an unusual company, as it is primarily engaged in insurance (think GEICO, for example), but also owns a lot of stock in public companies -- as well as many companies in their entirety, such as Dairy Queen, Benjamin Moore, Fruit of the Loom, and the Burlington Northern Santa Fe railroad. It's easy to see what Berkshire's top stock holdings are, because Buffett reviews them in his annual letter to shareholders. As of the end of June, Berkshire held about 4.3 million shares of Costco, valued at roughly $500 million (those shares would be worth close to $560 million today.)

It's no surprise that Berkshire would own some of this retailer, as the companies are connected in several ways. For one, Buffett's partner and Berkshire's vice chairman, Charlie Munger, is on Costco's board of directors, as is former Yahoo! president Susan Decker and Bill Gates' father. Munger, Decker, and Bill Gates are all on Berkshire's board. Munger has long raved about Costco (exclaiming, "If you get hooked on going to Costco with your family, you'll go for the rest of your life"), and Buffett greatly respects his opinions.  

Why might you buy Costco?
Buffett hinted at what he likes in Costco in his 2007 letter to shareholders, when he said that "a formidable barrier such as a company's being the low-cost producer (GEICO, Costco) ... is essential for sustained success."

Some might buy Costco just because Berkshire Hathaway did, but that's not a good enough reason. Fortunately, there are many others. For one thing, it's kind of a perfect company in many ways, treating all its constituents well -- shareholders (16% annual average stock gains over the past 20 years), employees (above-average pay and benefits), and customers (most items marked up no more than 14% over cost).

Costco is growing handily, too. It recently reported fourth-quarter results that showed sales at stores open longer than a year up an impressive 6%. Revenue and net income grew 9% and 13%, respectively, while gross margin also rose. Costco generates about $2 billion in free cash flow annually, despite a seemingly low net margin of about 1.8%. (As with many retailers, volume is the key.) International expansion is helping, and the company is targeting younger shoppers, too, by offering items such as kale and organic produce and through advertising on LivingSocial.

The company is also positioning itself for more growth, such as by a new partnership with Alibaba to sell its wares through the Chinese e-commerce giant's Tmall Global online platform. That's an inexpensive way to enter the massive Chinese market, without committing to brick-and-mortar stores.

Why might you not buy Costco?
If you want a hefty dividend payout, Costco isn't your stock -- for now. It yields about 1.1%, but over the past decade has hiked that by about 14% annually.

If you want rapid growth, you might want to look elsewhere, too. Costco's stock isn't likely to double within a year or two, but it is growing at a pretty good clip for such a large company (recent market cap: $57 billion). Better still, the bigger it grows, the stronger its purchasing power will be, and the more able it will be to offer low prices. Still, if its efforts to woo younger shoppers fail, Costco's growth rate will be pressured by an aging customer base.

The stock does not appear to be a bargain right now, but it has rarely seemed like one, often commanding a premium valuation. The company's P/E was recently 28, and when it was 25 in 2011, Munger told investors, "If you are comfortable with 25x earnings, slow advances, and working with great people, Costco at 25x earnings is one of the most admirable capitalistic institutions in the world." In 2014, he said:

Is Costco worth 25 times earnings? I think: Yes. Am I ready to sell any Costco? No. Would I buy more Costco at 25X earnings? I'm probably wrong, but I'd certainly rather buy Costco at 25X earnings than 90% of the other stocks. But I'm so spoiled it's hard for me to buy anything at 25X earnings.