Amazon.com (AMZN 1.30%) and Wal-Mart (WMT 0.94%) clashed on July 15 in a spontaneous attempt to generate Black Friday-like hype in the middle of the summer. It all started with Amazon's announcement of "Prime Day," a 20th anniversary sale featuring special deals as often as every 10 minutes throughout the day. However, the discounts were only offered to Prime members, who already pay $99 annually for Amazon's premium service.

Source: Amazon.com.

In response, Wal-Mart -- which has been trying to catch up to Amazon in e-commerce for years -- launched its own rival sales day with comparable deals. In a blog post, Walmart.com CEO Fernando Madeira criticized Amazon's Prime requirement, stating that "asking customers to pay extra in order to save money just doesn't add up for us." Amazon Prime global VP Greg Greeley responded by telling CNN Money that the idea of Wal-Mart offering discounts online instead of in stores "doesn't add up," either.

It's obvious that consumers could get great deals as these two retail giants collide, but it's harder to understand how these massive sales help Amazon, Wal-Mart, and their investors.

How does this help Amazon?
Amazon's biggest weakness is its lack of profitability. Over the past four quarters, it's only posted a profit once, although revenue has continued rising annually.

Amazon's margins are basically nonexistent for three reasons. First, Amazon must keep matching or beating prices at brick-and-mortar competitors. Second, it keeps developing new products, like Kindle tablets and set-top boxes, to tether more users to its ecosystem. Owners of those devices are more likely to sign up for Prime, which offers free e-books from its lending library, unlimited streaming of select media, unlimited cloud storage of photos, and other perks. Lastly, it's willing to take losses -- as it's likely doing with Prime Day -- to convince more users to sign up for Amazon Prime.

Amazon now has about 44 million Prime members in the U.S., according to Consumer Intelligence Research Partners. That's more than double the 20 million members that the company claimed to have last January. CIRP estimates that Prime members spend an average of $1,200 per year with Amazon, versus $700 annually for non-members. That's why Amazon is willing to take losses with promotions like "Prime Day" to convince new Prime members to sign up.

How does this help Wal-Mart?
Meanwhile, Wal-Mart has been fighting a tough battle against Amazon over the past decade. The rise of Amazon turned Wal-Mart's stores into showrooms for online purchases, and the introduction of barcode scanning apps made it even easier.

Source: Wal-Mart.

However, Wal-Mart realized that it could use its brick-and-mortar stores (4,562 in the U.S. alone) as "hybrid" fulfillment centers for online orders. According to Wal-Mart, about a third of its online orders are already picked up or shipped from those stores instead of its 42 online fulfillment centers across the U.S. Wal-Mart also plans to invest $1.2 billion to $1.5 billion on the expansion of its e-commerce efforts this year, up from $1 billion last year. Last quarter, its online revenue rose 17% annually, but that growth failed to boost its overall sales, which slipped 0.1%.

In response to Prime, Wal-Mart is testing a $50-per-year service, which offers unlimited three-day free shipping with no minimum purchase required. To counter Amazon's Prime Fresh -- which combines same-day grocery deliveries with Prime benefits for $299 per year in select cities -- Wal-Mart also introduced an online grocery delivery service in five markets. Wal-Mart's service costs $5 to $7 per delivery, but it offers curbside pickup for free.

Therefore, responding to Amazon's "Prime Day" with a sale of its own was a mindshare play for Wal-Mart. Wal-Mart is leveraging its strength in brick-and-mortar stores to expand online and keep customers shopping at its store across both platforms.

Amazon has the upper hand
Wal-Mart is putting up a good fight, but in the long run, Amazon will likely win. The problem is that Amazon won the mindshare battle years ago. Google chairman Eric Schmidt admitted last year that "almost a third of people looking to buy something started on Amazon... more than twice the number who went straight to Google."

Meanwhile, the growth of Amazon's Prime user base has created a massive defensive moat around the company. Wal-Mart can offer comparable delivery services, but it can't offer e-books, videos, cloud storage, or any of Amazon's other digital perks. The bigger that ecosystem gets, the harder it will be for Wal-Mart to gain ground in e-commerce.

Wal-Mart will likely keep responding to Amazon's headline-grabbing promotions, but it's a lopsided battle. Wal-Mart is offering big discounts to simply keep up with Amazon, while Amazon is doing it to expand its Prime ecosystem.