Walmart
A Walmart sign is seen in Miami, Florida, Aug. 18, 2015. Joe Raedle/Getty Images

Walmart (NYSE:WMT) has aggressively gone after Amazon.com's (NASDAQ:AMZN) Prime shipping services over the past few years. It first created a ShippingPass subscription service, but after seeing limited interest, it rolled out free two-day shipping on a couple million items with no annual fee. After Amazon announced plans to move Prime from two-day standard delivery to one-day delivery, Walmart announced its NextDay service and accelerated its rollout over the next few months. It's also expanding its $98 same-day delivery program focused on groceries: First it'll expand geographically, then the company will expand its product selection.

But Prime is just one of the "pillars" of Amazon's business, as its management likes to call them. Another big pillar of its retail success is the Fulfillment by Amazon service it offers third-party merchants. That's something Walmart's head of e-commerce, Marc Lore, says Walmart plans to pursue.

Pushing the flywheel

Amazon has developed a flywheel where Prime membership growth fuels the number of merchants using Fulfillment by Amazon, which in turn fuels sales and Prime membership growth. Third-party merchants are attracted to Amazon's massive customer base and can't afford to miss out on a sale, because they don't offer Prime shipping. The easiest way to provide Prime shipping is to use FBA.

Lore is looking to build a similar flywheel at Walmart. Specifically, he notes, the $98-per-year membership for unlimited same-day delivery of fresh and frozen groceries is at its core a way to get customers used to shopping with Walmart.com. "We don't have a reason, necessarily, to say 'Oh yeah! I'm gonna use Walmart.com,'" he said in a recent interview with Recode.

He doesn't expect the service itself to be very profitable, particularly in the early stages. He does, however, believe it can lose less money than competitors, including Amazon, delivering fresh and frozen groceries the same day customers order them thanks to its massive physical store footprint.

Ultimately, he expects to generate positive margins from the sale of longtail general merchandise items at scale -- that is, items customers don't buy very often but which carry higher markups than everyday items. It'll start selling more of those when it expands its $98 Delivery Unlimited service to include nearly everything it sells in its Supercenters and as customers become more familiar with Walmart.com.

Moreover, he thinks making shopping on Walmart.com a habit for more consumers will enable the company to sell more items from third-party merchants, sell more advertising, and importantly, sell fulfillment services to its merchants. Those are very high-margin sales compared to delivering groceries to customers' doors.

Lore is willing to sacrifice profitability today for the chance of building a business -- fulfillment -- that could be much more profitable in the future.

Taking on Amazon logistics with a little help

Walmart may have a little help in its efforts to offer fulfillment services to its third-party merchants. FedEx (NYSE:FDX) recently ended its relationship with Amazon. Meanwhile, the shipping company has gotten even closer with Walmart. It partnered with the big-box retailer to put shipping centers inside 500 stores last year, and Walmart is using FedEx's new Extra Hours service to ship orders from stores for faster fulfillment.

Walmart's fulfillment services could lean heavily on FedEx, just as its own first-party fulfillment does. FedEx moves nearly 60% of Walmart's e-commerce packages the last mile to customers' doors.

Importantly, there's a big missing piece in FedEx's top line after its decision not to renew its contract with Amazon. If Walmart can help FedEx bring in new revenue through its fulfillment services, it's likely willing to work closely with the retailer on offering more services to smaller merchants.

Establishing a cost-effective alternative to Fulfillment by Amazon is just one part of Lore's overall strategy for Walmart.com. He's trying to push both sides of the equation to get both more shoppers and more merchants using the platform for their needs. Because if either side starts showing strong momentum, the other will follow and start spinning that flywheel. That said, there's a long way to go to catch up to Amazon, and the online giant's not slowing down either.

This article originally appeared in the Motley Fool.

Adam Levy owns shares of Amazon. The Motley Fool owns shares of and recommends Amazon and FedEx. The Motley Fool has a disclosure policy.