Uncovering and explaining how our digital world is changing — and changing us.

Walmart, the world’s largest retailer, announced it will acquire two-year-old online retailer Jet.com for $3.3 billion in cash and stock in the largest-ever acquisition of an e-commerce company.

Jet co-founder and CEO Marc Lore will continue to run Jet as well as Walmart’s U.S. e-commerce operations after the acquisition closes, according to sources. The deal includes $3 billion in cash, as well as $300 million in Walmart stock that will be paid out over time as part of an incentive bonus plan for Jet executives.

The announcement comes after Recode first reported the deal was finalized over the weekend. Walmart and Jet declined to comment on the earlier report.

For Walmart, the purchase marks a giant bet on a largely unproven startup that only launched its shopping site widely last July. Up until now, the largest U.S. e-commerce acquisition was last year’s $2.4 billion sale of Zulily, a public company, to QVC.

The Jet acquisition is an acknowledgement by Walmart CEO Doug McMillon that his company needs outside help if it’s ever going to close the giant gap with Amazon. It’s still unclear whether that is the right strategy for the brick-and-mortar retailer.

Lore spoke about battling Amazon on Recode Decode last December:

The deal is in many ways a marriage of necessity, but a shot worth taking, as I explained last week when news of the talks first broke.

Walmart’s $14 billion in annual e-commerce sales is a fraction of Amazon’s $99 billion and is growing slower than the industry average. Its growth rate has decelerated for five consecutive quarters.

Jet.com was co-founded in 2014 by the entrepreneur Marc Lore in an attempt to build a new online megastore that would compete with the likes of Amazon, Walmart and Costco. Jet has secured more than $800 million in financing since its founding but is spending $20 million to $25 million on advertising a month to fund its growth. It is not profitable.

It most recently raised a $619 million round that gave it a value of more than $1.6 billion, but was going to have to keep raising huge sums of money to survive on its current path.

Lore pulled the rip cord instead, but he will be rewarded handsomely — he owns about 25 percent of the company, according to sources. Such a stake suggests Lore stands to make as much as $750 million in the deal. He will now have Walmart’s deep pockets — the company registered $15 billion in profits last year — to try to fuel more growth at Jet.

Lore will stay on and run Walmart.com as well as Jet.com, two sources said. It seems likely that he will report to McMillon, the CEO.

Walmart’s current global e-commerce chief, Neil Ashe, will eventually depart after a transitional period, these people said. He joined Walmart in 2012 after a three-year stint at CBS Interactive.

Lore previously co-founded Diapers.com’s parent company and sold it to Amazon for $550 million in 2011 after the two sides battled through a pricing war that threatened to put the startup out of business.

Jet sells more than 12 million products ranging from TVs to toys to cereal, and even milk and other fresh groceries in some markets. A little less than a third of its sales volume comes from items that Jet stores in its own warehouses and sells directly to customers, an exec recently told Recode.

The remainder comes from a network of more than 2,000 vendors who list their own products on Jet.com and ship orders to Jet customers from their own facilities. The company typically takes a cut of 8 to 15 percent on these orders. As of March, Jet was on track to sell more than $1 billion worth of goods over the next 12 months, though it only records a fraction of that as revenue.

Jet has attempted to stand out from competitors through a discounting model, dubbed the Smart Cart, that rewards customers with greater discounts as they add more items to their order.

Jet also gives customers additional discounts if they forfeit the right to return an item, or pay with a debit card instead of a credit card. Four million people have made a purchase on Jet since it launched, but the company recently shifted its advertising efforts to getting existing customers to come back more often.

Jet originally planned to charge customers a $50 annual membership fee in exchange for even larger discounts, but scrapped that model before its launch. At the time, Lore explained the move in part by saying that some brands did not want to sell goods on a site that was considered a discount destination.

On the back end, Jet’s technology can identify in real time which orders should be routed to which vendors to garner the lowest fulfillment and shipping costs — a model that is said to allow the company to provide bigger discounts for bigger orders. Vendors are able to set business rules so they only accept orders that will be profitable for them, Lore has previously said.

Such technologies were attractive to Walmart, according to sources, as it attempts to use its vast store and warehouse footprint to reduce shipping costs and cut down on delivery speeds. Amazon has put pressure on the whole industry through its Amazon Prime shipping program, which now delivers some goods in as little as two hours in dozens of cities.

Walmart is expected to utilize some parts of the pricing technology on its other e-commerce sites. Walmart may also use some of Jet’s technologies to expand the business it gets from other vendors selling their wares through Walmart.com. This model — known as a third-party marketplace — is also employed aggressively by Amazon, which now gets around half of its unit sales from that group.

Even with Walmart acquiring the strong Jet leadership team and proprietary technology, the deal still will be viewed as a rich, if not desperate, one by some industry observers.

Jet does not disclose revenue numbers, but my back-of-the envelope math suggests the company is on pace to do no more than around $500 million in revenue over the next year. An acquisition price that is six times a company’s revenue is mostly unheard of in e-commerce, especially for a company that is nowhere near profitable. Dollar Shave Club sold to Unilever for between four and five times revenue but had said it could be profitable on an Ebitda basis by year’s end.

Amazon, by comparison, currently trades around 3.7 times its e-commerce revenue and has registered record profits three quarters in a row.

Jet is based in Hoboken, N.J., and has raised investments from several of Diapers.com’s original backers including Accel Partners, NEA and MentorTech Ventures. Jet also took investments from Primary Venture Partners, Bain Capital Ventures, Google Ventures and Alibaba.

Lore had been known to regale the press with his ambitious plan to build a long-term stand-alone business that could be worth tens of billions some day. Jet’s investors are still pleased. Several have told Recode privately that they thought the chances of a successful outcome were slim to near-impossible, even with the background of Lore and his co-founders. Now, they’re cashing out tens of millions or more, in some cases.

"Not bad for two years’ work," one said.

Correction: An earlier version of this article incorrectly stated Lore would run Sam's Club's online operation. He will only run Walmart and Jet's e-commerce businesses.

Update: The story was updated to include official announcement of the deal from Walmart.