"Brick and mortar retailers are dying."

Tell me if you've heard that one over the past five years. As e-commerce grows stronger each year, investors are shunning traditional retailers in droves. Right?

An empty parking lot.

The image many of us have when thinking of big-box retailers. Image source: Getty Images

But don't tell that to Wal-Mart (WMT 1.32%) or Lowe's (LOW -1.40%), the two stocks facing off in today's battle. Combined, they collected over $25 billion in free cash flow in 2016 and had sales topping a half-trillion dollars.

Between the two, which is the better buy today? That's impossible to answer without a fully functioning crystal ball, but we'll do our best to dig deeper by approaching the question from three different angles.

Sustainable competitive advantages

There is absolutely nothing more important to investigate than a company's sustainable competitive advantage -- often referred to as a "moat." If I could go back in time and talk to my beginning-investor-self, I would make this simple point abundantly clear.

That's because a moat represents the special something that separates a company from its competition. Over a long enough time frame, it is what separates the winners from the losers, what keeps customers coming back again and again, and what keeps the competition at bay for years.

Wal-Mart's key advantage has always been its scale. No one did a better job at focusing on small, rural communities, buying things in bulk, and lowering overhead costs better than the Walton family. That led to market-thumping returns for decades.

But that moat has been mightily disrupted by Amazon.com (AMZN -1.64%). With e-commerce taking more and more of the retail pie every year, the very thing that made Wal-Mart great -- its physical presence throughout the United States and the world -- has become its Achilles' heel. Customers value convenience above all else, and if packages can be delivered right to their front door, then that's what they'll go with.

Lowe's has been able to avoid the Amazon bug by nature of its business. It simply isn't practical to deliver most home-furnishing and construction purchases right to your door. In addition, these purchases are usually so large and long-lasting that customers like to see, touch, and try out the things they're buying before handing over their credit card.

Perhaps the best proxy for these trends is each store's comps -- or how much comparable-store sales increased in any given year.

Comps: A 5-Year History
Create column charts

Data source: Company annual reports

I simply think that Lowe's wins this battle because its business is more difficult to disrupt with e-commerce than Wal-Mart's. The company's solid position as the No. 2 home-furnishing store in America, the power of its brand, and its scale all offer a wider moat -- in my opinion -- than Wal-Mart has.

Winner: Lowe's.

Financial fortitude

Most investors, especially those who put their faith behind big-box brand names, like seeing cash returned to them. Of course, there's nothing wrong with that, as dividends are a key reason to invest in such names.

But investors should also want their companies to hold on to a hefty stash of cash. That's because every company, no matter what, is going to face difficult economic times. Companies that approach such times with a healthy balance sheet have options: Buy back stock, make splashy acquisitions, or -- most importantly -- outspend rivals to gain market share.

Debt-heavy companies are in the opposite scenario -- forced to narrow their focus to meet the demands of their debtors. Here's how Wal-Mart and Lowe's stack up in terms of financial fortitude, remembering that Wal-Mart is valued at over three times the size of Lowe's.

Company

Cash

Debt

Net Income

Free Cash Flow

Wal-Mart

$6.9 billion

$42 billion

$13.6 billion

$20.9 billion

Lowe's

$1.0 billion

$14.4 billion

$3.1 billion

$4.5 billion

Data sources: Yahoo! Finance, SEC filings.

Lowe's is by no means a slouch in this respect, but even after adjusting for the relative size of these companies, Wal-Mart comes out ahead. It has more cash, income, and free cash flow than Lowe's. This decision is very easy.

Winner: Wal-Mart.

Valuation

Finally, we have valuation. While this isn't an exact science, there are some straightforward metrics we can consult to give us an idea of how expensive each stock is.

Company

P/E

P/FCF

PEG Ratio

Dividend

FCF Payout

Wal-Mart

17

11

3.8

2.8%

32%

Lowe's

21

16

1.2

1.7%

25%

Data sources: Yahoo! Finance, E*Trade. P/E represents figures from non-GAAP earnings.

This is a much more difficult one to parse. Both companies offer very healthy dividends, but Wal-Mart's is noticeably bigger. Wal-Mart also appears to be cheaper on an earnings and free cash flow basis.

But growth rates are much higher at Lowe's. In fact, according to the PEG ratio, Lowe's trades at an astounding 65% discount to Wal-Mart. That's why I'm calling this one a draw.

Winner: Tie

The winner is...

So there you have it: It's a tie. If investors are more comforted by a strong balance sheet and very impressive cash flows, then Wal-Mart is the way to go. If, however, you want to know that a company is less susceptible to disruption in the form of e-commerce, I think Lowe's is a better bet.

I always use a company's moat as a tiebreaker if the companies end in a draw, so my vote here would be with Lowe's, but I can't deny the strength of Wal-Mart's cash flow.