Few markets have seen more consolidation than grocery stores over the past five years. While private equity has taken a bite out of the stocks available to own, Kroger (NYSE:KR) has also been a prime instigator: acquiring Harris Teeter and Roundy's, for instance, to drastically expand its locations.

The underlying trend is the fact that moats are disappearing before our eyes. While shoppers may have once been married to a certain store, price and convenience are now king. That's something Whole Foods (NASDAQ: WFM) has learned the hard way, as natural and organic goods are now available everywhere.

A man checking his phone while shopping for groceries.

Image source: Getty Images

So in a battle between these two national chains, which has the better stock to buy now? That's impossible to measure with 100% accuracy, but if we take a look at the question from three different angles, we can get a better idea for how they stack up.

Sustainable competitive advantages

If you're a beginning investor, I have some advice: Spend the vast majority of your time identifying and evaluating the moat of the companies you are investing in. Over a long enough time frame, nothing will have a greater impact on your investing returns.

At its core, a sustainable competitive advantage -- or "moat" as it's called in investing circles -- is what separates one company from another. It is what keeps customers coming back for more, while keeping the competition at bay for decades.

As I mentioned above, moats have been disappearing in the grocery business, with price and convenience being the most important factors to consider. On that basis, Kroger has the upper-hand, with almost 2,800 locations nationwide versus Whole Foods' 439.

That's showed up in comparable store sales, or comps, over the past five years as well, with these two going in opposite directions.

Whole Foods vs. Kroger: Comps
Create column charts

While I don't think the moat surrounding either business is particularly strong, Kroger's clearly has the edge.

Winner = Kroger

Financial fortitude

Given that moats are shrinking and companies are competing more and more on price, financial fortitude matters. Companies that have cash on hand will have options: continue pricing competition under the table or make acquisitions. Debt-heavy players will be in the opposite boat, likely forced to sell out to others.

Keeping in mind that Kroger is valued at about two-and-a-half times the size of Whole Foods, here's how the two stack up.

Company

Cash

Debt

Net Income

Free Cash Flow

Whole Foods

$1 billion

$1 billion

$402 million

$411 million

Kroger

$322 million

$11.8 billion

$2 billion

$573 million

Data source: SEC filings, Yahoo! Finance.

Here we have an interesting dynamic. Kroger has spent money hand over fist acquiring chains and improving the condition of their existing locations. That has given them an edge when it comes to a moat.

At the same time, however, it has made the company more fragile, with debt far outweighing cash on hand. Whole Foods is in the opposite boat, giving in a more favorable balance sheet in this match-up.

Winner = Whole Foods

Valuation

Finally, we have valuation. While we don't have a one-size-fits-all metric to compare any two companies, we can use multiple data points to make an informed analysis.

Company

P/E

P/FCF

PEG Ratio

Dividend Yield

FCF Payout

Whole Foods

25

27

3.6

2.1%

43%

Kroger

14

49

2.3

1.6%

75%

Data source: SEC filings, Yahoo! Finance. P/E calculated using non-GAAP EPS.

This is pretty much a draw. Kroger looks more expensive on a free-cash-flow basis, but it's also selling at a 35% markdown to Whole Foods based upon growth prospects (PEG Ratio).

Both companies have decent dividends -- with Whole Foods recently bumping its payout up significantly -- and both are fairly stable.

Winner = Tie

My winner is...

So there you have it: We have a draw. When forced to choose in this scenario, I always side with the company that has the wider moat. In this case, that would be Kroger.

However, I don't think either company is a very good buy. When moats are shrinking, investing returns over the long-run usually suffer. I don't see why it would be any different in the grocery industry.

John Mackey, CEO of Whole Foods Market, is a member of The Motley Fool's board of directors. Brian Stoffel has no position in any stocks mentioned. The Motley Fool owns shares of and recommends Whole Foods Market. The Motley Fool has a disclosure policy.