There's an old investing maxim that you should not buy gold mining companies, you should buy companies that sell pickaxes to the gold miners. Put another way, if you haven't a clue which of several end-product makers is going to win out in the market, the safer play may be to buy stock in the manufacturers who make the parts they use to make their merchandise.

So for example, if you're not sure who is going to succeed in the epic battle between Hewlett-Packard (NYSE:HPQ) and Dell (NASDAQ:DELL), your best bet may be to not bet on either one.

You might want to instead buy stock in chipmaker Intel (NASDAQ:INTC), which makes the guts for most of the computer makers' machines. Or in Microsoft, which makes their brains. That way, it doesn't really matter whether Dell continues to crush its competition or HP comes from behind and steals Dell's market share. Either way, you own the company that is selling to the winner and to the loser -- making money off of both.

A pizza stock cook-off
Lets look at two Hidden Gems types that illustrate the theory. The first is an official Hidden Gems recommendation, Middleby (NASDAQ:MIDD), which manufactures pizza ovens; the other is a less-hearty endorsement, or "watchlist stock," Papa John's (NASDAQ:PZZA), which uses Middleby's pizza ovens to make, well, pizzas.

Each of these two companies came onto Hidden Gems members' radar roughly one year ago (PJ's in September 2003, Middleby in November 2003). But since then, their stock price gains have differed markedly. PJ's is up from about $26 to about $31 over the course of the year, for about a 19% gain -- not too shabby. But Middleby? Middleby has rocketed from $20 to $50. That's a 150% return in less than a year.

A quick study of the two companies' financials is all it takes to reveal why Middleby has generated eight times the money for its investors as PJ's has for its shareholders. Here are a few numbers taken from the companies' respective pages on Yahoo! Finance, including growth numbers for the past two years:

Papa John's Middleby
Market capitalization $520 million $465 million
Enterprise value $620 million $515 million


$33.4 million $33.2 million
EV/FCF ratio 18.6


Profit margin 2%


Return on equity


Annual revenue growth



Annual FCF growth



Source: Yahoo! Finance

When you place the two companies' numbers side-by-side like this, it's amazing how similar they are: Their market caps and enterprise values are very close, with PJ's being valued slightly higher. The resemblance between their free cash flows is even more striking -- just a hair more than $33 million for each.

But the differences between the two companies stand out even more starkly. Middleby generates returns on equity of more than three times PJ's. And the pizza oven maker's profit margin is five times that of the pizza maker.

Then, look at how quickly each company is growing. Middleby may have its share of competition from businesses as small as Enodis PLC to companies as big as Illinois Tool Works (NYSE:ITW) and United Technologies (NYSE:UTX), but Middleby is thriving nonetheless, with revenues rising an amazing 54% per annum over the past two years and free cash flow not far behind at 46.6%. Meanwhile, PJ's is doing considerably less well in beating off the competition it faces from Domino's Pizza and Yum! Brands' (NYSE:YUM) Pizza Hut. Its free cash flow growth is barely keeping up with inflation, and its revenues are heading in precisely the wrong direction.

Facts are stubborn things
Why is it, exactly, that the little pizza maker is struggling while the just-as-small pizza oven maker's business is going positively gangbusters? Both companies face plenty of competition from bigger-name and better-capitalized rivals. Yet the facts are undeniable: One company wilts in the face of competition while the other thrives.

One conclusion, at least, is obvious: Middleby is clearly the better-managed of the two companies. While all sorts of different kinds of businesses sport different levels of profit margins, returns on equity are directly tied to a business's efficiency. And Middleby is the more efficient business by a wide margin. So it's only logical that its stock price should appreciate at a faster rate than PJ's.

Agnostics can sidestep the trends
As regular Fool readers know, the pizza makers are caught in the midst of two trends that hamper their ability to make profits. First, the price of cheese, which is the largest component of the cost of any pizza, has been rising for years. Second, the pizza industry seems in a perpetual state of price warmongering. These kinds of trends carry with them consequences: Every pizza costs more to make, but the pizza hawkers can't pass that cost on to their customers without losing market share.

So to return to the thesis of this article, I think Middleby's business has another factor in its favor that PJ's lacks: It sells the pizza industry equivalent of pickaxes. Anyone who wants to dig for gold in the pie market has to buy its tools from Middleby (or one of its competitors). It doesn't matter whether profit margins in pizzas are stuffed-crust or thin -- you still need to bake them. And in the end, whether it's Domino's or PJ's that ultimately hits the market share motherlode, Middleby profits either way.

Buying high-profile companies engaged in high-profile price wars may be fine and dandy for other investors. But at Hidden Gems, we like to look deeper. Try our service now -- for free -- and let Tom Gardner show you how to profit from companies that make their money behind the scenes, unknown, unseen, unloved... and undeniably undervalued.

Fool contributor Rich Smith owns shares of Nokia but of no other company mentioned in this article. The Motley Fool is investors writing for investors.