Chipotle Mexican Grill (NYSE: CMG) is a great company by almost any measure of performance. Since 2007, it's opened more than 500 new locations, more than doubled its top-line revenue, increased sales per restaurant from $1.7 million to over $2 million, and improved its operating margins by nearly 50%. To top things off, moreover, it's accomplished these objectives with little to no outside financing, paying for virtually everything with cash.

But being a great company doesn't necessarily mean its stock is a buy. Just ask someone who's held Wal-Mart (NYSE: WMT) shares for the last 10 years. While it was unquestionably a great company in 2002, its stock has since gone absolutely nowhere. It traded for $61.30 a decade ago and $61.20 today -- to be fair, of course, it did average about a 1.5% dividend yield over the time period, but this was still short of inflation, which averaged roughly 2%.

The key is value
To answer the question of whether a stock like Chipotle is a buy, we use the price-to-earnings ratio to determine whether its shares are over- or undervalued. This metric estimates how much a prospective shareholder must pay for each dollar of a company's earnings. And by doing this, it makes it possible to compare a specific company's value relative to its peers and the broader market. In a very simplistic understanding of it, smart investors prefer companies with lower (as opposed to higher) relative P/E ratios.

Using this measure, in turn, it'd be easy to conclude that Chipotle's stock is overvalued. As you can see in the table below, with a forward P/E ratio of 38.7, a dollar of Chipotle's earnings are twice as expensive as McDonald's (NYSE: MCD) and Krispy Kreme's, and nearly 60% more expensive than comparable earnings at both Starbucks (Nasdaq: SBUX) and Panera Bread (Nasdaq: PNRA).

Company

Forward P/E Ratio

Location Count

Net Margin (TTM)

Chipotle 38.7 1,230 9.5%
Starbucks 24.7 17,244 10.5%
Panera Bread 24.6 1,504 7.5%
Krispy Kreme 16.9 678 5.4%
McDonald's 15.4 33,510 20.4%

Sources: Morningstar.com, Retailsails.com, and respective company websites. TTM = trailing 12 months.

It turns out, however, that this initial impression could very well be wrong. A Foolish colleague of mine, Adam Wiederman, recently discussed the risk of relying exclusively on the P/E ratio. The general problem, according to Adam, is that sometimes a company with a high P/E ratio may not actually be expensive.

Misleading, right? Take Amazon.com as an example. At the end of 2003, it traded for the sky-high multiple of 658 times earnings. Yet because of the Internet retailer's remarkable growth in the intervening time period, its shares have returned an astounding 290%.

Like Amazon, Chipotle's future growth could easily justify this multiple. With just over 1,200 restaurants, it has but a fraction of the locations operated by either Starbucks or McDonald's. By this measure, just taking a blind stab at it, one could reasonably envision an additional 2,000 outlets. Others have even tossed out 3,000 locations as the saturation point.

In addition, because the company is debt-free for all intents and purposes, equity holders needn't share any of the company's operating earnings with creditors via interest payments (as shareholders of most other companies must). In 2011, for example, creditors of Starbucks and McDonald's took home $33 million and $493 million, respectively.

Finally, though not insignificantly, all of the above excludes any potential profits from the burrito chain's Asian offshoot, ShopHouse. While the latter is still ostensibly a pilot program, if the success of the first location is any indication, there's reason to believe that it'll be extremely lucrative. Take it from me: The food is good and the place is often packed.

Bite that burrito
One of our guiding principles here at The Motley Fool is that investors should never shy away from investing in great companies like Chipotle. While its earnings multiple makes the burrito chain appear over-valued, its potential seems likely to exceed the expectations priced in. For another stock along these same lines, check out our recently released free report: "The Motley Fool's Top Stock for 2012." It profiles an under-the-radar company that our analysts believe could be a big-time multibagger. To access this report before it's no longer available, click here now -- it's free.