Image source: Amazon.

Brick-and-mortar retailers like Wal-Mart Stores (NYSE:WMT) are struggling to grow their revenue and earnings. Last year, Wal-Mart's revenue declined 0.7% and EPS fell 9.5%. Investors have clobbered the stock as a result, sending shares down 20% over the past 12 months. Other brick-and-mortar retailers like Target (NYSE:TGT) aren't doing much better, with less than 1% revenue growth over the past year.

Meanwhile, Amazon's (NASDAQ:AMZN) stock continues to climb higher, and it only just started turning a consistent profit. And while Amazon's profits are expected to grow significantly over the next few years, management has trained investors to expect continued investments to support long-term growth of its retail operations, which could negatively affect earnings in the short term. Whereas companies like Wal-Mart and Target must invest to secure sales for 2016, Amazon can invest in improving the customer experience in 2020 and beyond.

Investing long-term
With Amazon Web Services -- the cloud computing arm of Amazon's business -- now throwing off profit, there's less pressure on Amazon to make a profit from its retail efforts. Last year, AWS accounted for 83% of Amazon's total operating profit, and it's expected to grow faster than the rest of the company's operations. AWS' profitability allows Amazon to invest in technology to improve the customer experience on Amazon's retail website without worrying about the impact on its core business' profitability.

The biggest investments Amazon is making are in improving Prime, its two-day shipping program that comes with streaming video on demand, a music streaming service, unlimited photo storage, and more.

Amazon is investing in expanding its Prime Now program, which extends free two-hour delivery to Prime members for select items in certain cities. Customers can get items within one hour for an additional charge. The program is currently available in over 20 cities, and quickly expanding. Such a program is obviously very expensive, but it helps Amazon compete with brick-and-mortar retailers for those items you really need right now.

Not all Prime Now deliveries are fulfilled from Amazon's warehouses. The retailer partners with local grocers and retailers to provide grocery delivery and other goods. But Prime Now is another benefit to becoming a Prime subscriber, which ultimately fosters loyalty to Amazon when customers have less immediate shopping needs.

Additionally, Amazon is spending billions of dollars on its Prime Instant Video service. In 2014, Amazon spent $1.3 billion on content. As its number of original series and films expanded, so too has its content budget. Amazon can afford to spend a lot on video content, because it's one of the biggest factors that helps retain Prime members. As Prime membership expands to more households, retention will become increasingly important in order to sustain growth.

What can Wal-Mart and Target do?
Wal-Mart and Target have both committed to significant investments in their operations. Target said it will invest $2 billion to $2.5 billion annually to improve its supply chain and technology starting in 2017. Wal-Mart is committing about $2 billion between this year and next year to improve its online sales.

But they simply can't expect to compete with Amazon and its ability to invest practically all of its retail profits back into its business. Wal-Mart, Target, and other brick-and-mortar retailers need to pick a target customer and create the best possible experience for that customer. Are they into bargain shoppers like Aldi supermarkets, which sacrifices customer experience for price, or do they want to provide a superb customer experience and be less competitive on price. They can't afford to do both; Amazon may be the only retailer that can.

Amazon is leveraging its biggest strength to become the dominant force in retail. So, as Wal-Mart and Target struggle to grow sales, Amazon is growing sales around 20% annually, despite being one of the largest retailers in North America already.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.