Wal-Mart (NYSE:WMT) is adding free curbside pickup of groceries to eight new cities this month to counter Amazon's (NASDAQ:AMZN) growing presence in same-day grocery deliveries. This expansion, which also adds stores to existing markets, will increase Wal-Mart's curbside pickup locations by a third to around 200 and enable it to reach 30 cities. COO Michael Bender told Reuters that the company might expand the service to a much larger percentage of its 4,574 domestic stores.

Image source: Wal-Mart.

Wal-Mart currently offers over 30,000 fresh groceries, household items, and baby products for free curbside pickup. Customers place the order online, choose the pickup time, pull up to a designated parking area, and let a Wal-Mart "personal shopper" load the items into their cars. It's an interesting approach which turns Wal-Mart's massive retail footprint into pickup centers, which might be preferable to paying hefty same-day delivery fees or subscribing to Amazon Prime Fresh, which costs $299 per year.

Why curbside pickups matter
Wal-Mart's network of brick-and-mortar stores is much bigger than Amazon's network of 104 fulfillment centers in North America. Wal-Mart finished last year with just 19 dedicated e-commerce fulfillment centers, so it relies heavily on shipping orders from brick-and-mortar stores.

By adding in-store and curbside pickup to those stores, Wal-Mart eliminates packing and shipping expenses while allowing customers to pick the time they want to claim their orders. This strategy complements Wal-Mart's promise to match prices from Amazon or other online competitors. By eliminating shipping fees or membership plans, Wal-Mart has a better shot at offering cheaper products than Amazon. Amazon also offers self-pickup with its Lockers, but those metal cabinets are essentially big P.O. boxes which still require shoppers to pay general shipping fees.

Amazon Lockers. Image source: Amazon.

Complementing Wal-Mart's other plans
Wal-Mart is countering Amazon in other ways. For customers who still prefer home delivery, Wal-Mart started testing a $50 per year subscription service with unlimited three-day shipping last year. That's cheaper than Amazon's $99 per year Prime plan, which offers free two-day shipping, free same-delivery on qualifying orders, special discounts, media streaming, cloud storage, and other perks.

Wal-Mart tried to expand its digital presence by acquiring online video service Vudu six years ago. Last year, it launched the Vudu Spark, a $25 streaming stick to challenge Amazon's Fire TV stick and Google's Chromecast. It also stopped selling Amazon's Kindle and started selling its own e-books for iOS, Android, and Windows devices. However, Wal-Mart hasn't bundled these digital services into its subscription-based shipping plan to challenge Prime.

Wal-Mart's digital arm, @WalmartLabs, made over a dozen acquisitions over the past four years to improve Wal-Mart's app with better social recommendation, customer engagement, and price comparison features. The division recently unveiled its own mobile payment platform, Walmart Pay, to counter other mobile payment apps and track customer purchases.

But it's a costly strategy
Wal-Mart's efforts to widen its moat against Amazon are admirable, but they're also expensive. The company invested nearly $1.3 billion in e-commerce expansion in fiscal 2016, up from $1 billion in 2015. It spent another $1.2 billion during the year on wage hikes and the introduction of new associate training and educational programs. Wal-Mart expects these expenses to cause its earnings to drop 6% to 12% this year.

But if we compare Wal-Mart's revenue growth to Amazon's over the past decade, it's clear that Wal-Mart needs to make those big investments to evolve.

WMT Revenue (TTM) Chart

Source: YCharts

Amazon's operating margins are also catching up to Wal-Mart's, thanks to the growth of its high-margin AWS (Amazon Web Services) division. Amazon reported an operating margin of 2.1% last year, up from 0.2% a year earlier. Wal-Mart's operating margin declined from 5.6% to 5% between fiscal 2015 and 2016. If Amazon's profitability improves as Wal-Mart's worsens, Amazon could gain more pricing power against Wal-Mart, forcing the latter to slash prices as it invests heavily to keep up.

Amazon still has the upper hand
Wal-Mart might have found a clever way to widen its moat against Amazon Prime Fresh, but that grocery delivery service is only active in a few select markets. If push comes to shove, Amazon can probably convince participating retailers to also offer free in-store pickup services.

Wal-Mart also still doesn't have a meaningful way to counter the growth of the prisoner-taking Prime ecosystem, which pulls in customers with free deliveries, digital services, and connected devices like the Kindle, Fire TV, and Echo. Until it can do so, Amazon will retain the upper hand, forcing Wal-Mart to invest heavily in initiatives to strengthen its e-commerce business, which generated just 3% of its constant currency sales in 2016.

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.