Wal-Mart (NYSE:WMT) has been an aggressive player in the e-commerce market over the past 18 months. Since acquiring Jet.com last year and installing Marc Lore as head of U.S. e-commerce, Wal-Mart has seen online sales surge. Wal-Mart's various online stores saw sales increase 60% year over year in the second quarter.

But its latest move is a bit curious. Wal-Mart is raising online prices for certain items, mostly groceries, in an effort to improve profitability and draw more customers into its stores, where they'll potentially do more shopping than they would online.

The move isn't exactly unprecedented. Costco Wholesale typically charges more for online orders than it does in stores for similar reasons. But making the move in the fourth quarter -- peak shopping season -- and following Amazon.com's (NASDAQ:AMZN) big push into brick-and-mortar with its Whole Foods acquisition makes the timing quite risky.

A conveyor belt of boxes from Walmart.com

Image source: Wal-Mart

Improving profitability

At last month's investors' conference, Lore said the e-commerce division will post its largest loss in e-commerce this year, and it will improve slightly in 2018. Profitability will, supposedly, continue to improve as Wal-Mart's online sales continue to grow.

Lore has taken several initiatives this year to help boost Wal-Mart's online sales. The company started offering free two-day shipping on orders from Walmart.com, and it's rapidly expanding its online grocery-ordering platform.

By introducing a disincentive to ordering certain products online, Wal-Mart can save on shipping costs. "There's no cheaper way to get these products to consumers than have them come in the store and pick it off the shelf themselves," Lore said at the investors' conference. Wal-Mart is also reportedly pushing suppliers to offer more bulk items, which could help increase order sizes and reduce unit shipping costs.

Getting customers in the door

Wal-Mart's online business is still small potatoes compared with its in-store sales. Wal-Mart has done an effective job navigating the competitive brick-and-mortar retail market. Same-store sales have increased for 12 consecutive quarters.

But with more people doing their shopping online and Amazon's push into brick-and-mortar with Whole Foods, Wal-Mart faces a major risk. Driving more customers to pick up online orders in stores is a key piece to its new strategy. If a customer is going to Walmart to pick up an online order, that customer can buy groceries or that household item while he or she is there, instead of at one of Wal-Mart's competitors.

What about Amazon?

While the theory behind Wal-Mart's new strategy is sound, Amazon could throw a big wrench in all of the company's plans. Wal-Mart's online prices are now usually matched with Amazon's. But Wal-Mart doesn't benefit from extremely loyal Prime customers.

All else being equal, including price, an Amazon Prime member is going to buy something from Amazon instead of from Walmart.com. Not only does Wal-Mart lose the sale, but it also loses out on potential additional purchases customers might make to reach the $35 free shipping threshold on Walmart.com. Consumer Intelligence Research Partners estimates there are now about 90 million Prime households in the United States.

While Wal-Mart will offer lower prices for online orders picked up in stores, the selection of items could be more limited, and, more importantly, that's much less convenient for most shoppers. Even if shoppers prefer to shop in stores, they sought out the product online because they probably want to purchase the product online.

Amazon is taking the opposite approach. It's actively lowering prices on products -- even the ones it doesn't sell directly. It's also slashed prices at Whole Foods. The move should help draw price-sensitive customers that Wal-Mart previously attracted.

Wal-Mart's decision to increase prices online just ahead of the holiday shopping season is particularly risky. Amazon CEO Jeff Bezos has famously said that "your margin is my opportunity." Wal-Mart is giving Amazon a big opportunity.

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.