With the seemingly inevitable rise of e-commerce, it's no mystery that the retail industry is quickly changing. And some of the world's best-known traditional retailers are being left behind in the process.

But this also presents a dilemma for many investors today. Do you buy shares of the world's online retail leaders even at historic highs? Or should you take advantage of the depressed share prices of some primarily brick-and-mortar chains as they work to navigate this evolving retail landscape?

Let's take a closer look at two companies that I believe perfectly represent this dilemma today: J.C. Penney (JCPN.Q) and Amazon.com (AMZN -1.35%).

Man in suit weighing coins on a golden scale

IMAGE SOURCE: GETTY IMAGES.

The case for J.C. Penney

Shares of J.C. Penney have plummeted more than 50% so far in 2017, including a 28.5% decline last month after the department store chain delivered mixed fiscal second-quarter results.

More specifically, J.C. Penney managed to increase sales last quarter by 1.5% to just over $2.96 billion, well above the $2.84 billion investors were expecting. But those sales also resulted in a non-GAAP net loss of $28 million, or $0.09 per share, wider than the $0.05 per share predicted by Wall Street going into the report. On a GAAP basis, which includes the impact of one-time items like restructuring expenses, J.C. Penney lost $62 million, or $0.20 per share.

However, J.C. Penney management was quick to point out that the company's profitability was held back by liquidated inventory at 127 locations it had previously scheduled for closure. Because those liquidations were isolated to last quarter, and coupled with its strong start to the crucial back-to-school season, J.C. Penney management reiterated guidance for full-year adjusted earnings per share in the range of $0.40 to $0.65.

What's more -- as evidenced by its top-line outperformance -- J.C. Penney enjoyed improved sales results from nearly every category last quarter, with particularly encouraging trends from its beauty, home refresh, and omnichannel growth initiatives. 

"[We] remain confident in our ability to further strengthen our balance sheet, while driving sustainable growth and long-term profitability for JCPenney," added company chairman and CEO Marvin Ellison. "[...]We are excited by this momentum and expect to deliver improved results in the back half of the year."

If J.C. Penney delivers on that promise in the coming quarters -- and with shares trading at just 10.5 times this year's expected earnings -- today's opportunistic investors could be poised for impressive gains.

The case for Amazon.com

Meanwhile, it's an exercise in contrast to look at Amazon.com, shares of which have climbed more than 25% year to date on the strength of its core retail business, burgeoning services segment, and multiple irons in the fire to further disrupt new industries.

Amazon's overall revenue skyrocketed 25% year over year to $38 billion last quarter alone, trouncing Wall Street's estimates by over $800 million in the process. Within that, net product sales climbed 17.2% to $24.75 billion, and service sales (notably including the massively profitable AWS business) jumped 42% to just over $13.2 billion.

Amazon also generated jaw-dropping operating cash flow of $17.9 billion during the quarter (up 37% year over year) and free cash flow of $9.7 billion (up 26%).

But on the bottom line, Amazon delivered net income of "just" $197 million, or $0.40 per share, badly missing expectations and down from $857 million, or $1.78 per share in the same year-ago period. Shares fell nearly 6% the following day as a result, which is one of the primary reasons Amazon stock currently sits around 13% below its 52-week high.

At the same time, longtime Amazon shareholders know that their company purposefully forsakes bottom-line profitability. Instead, Amazon consistently plows its profits right back into growing its enterprise value, whether through supplemental bets for incremental growth or strategic acquisitions. Amazon only just closed on its $13.7 billion purchase of Whole Foods Market in late July, for example, immediately dropping prices on thousands of popular Whole Foods items and leaving shares of multiple grocery competitors reeling.

In short, buying Amazon stock today is an effective bet that it will continue to achieve outsized growth from a position of relative strength.

The winner is...

With the caveat that J.C. Penney could rebound hard on signs of any sustained improvement for the remainder of this year, I still feel more comfortable betting on Amazon.com as the more likely business to survive and thrive over the long term. That's not to say there won't be more volatility along the way, but Amazon has repeatedly proven to be a winner that keeps on winning. And I think its recent pullback provides patient investors a perfect chance to open or add to a position.