For years, Whole Foods CEO John Mackey was convinced that grocery stores and e-commerce didn’t mix. And I was more surprised than most when the news broke last week that he’s selling Whole Foods to Amazon (amzn, +0.68%) for $13.7 billion.

In the late 1990s, at the peak of the dot-com boom, Mackey tried his hand at e-commerce, just like everyone else. Wholepeople.com, Whole Foods’ e-commerce subsidiary, didn’t end well: The company had hoped to take it public, but instead spun it off and took a $500,000 write-down. “I realized within a few months this business model doesn’t work,” Mackey told me in 2002, two years after WholePeople was spun off into something called Gaiam. He righted the Whole Foods ship by refocusing on brick-and-mortar retail and going on an expansion boom, which would boost the stock price five-fold at its peak.

Even at a high-end specialty grocery store nicknamed “whole paycheck,” there were inescapable truisms. The grocery business is among the most pedestrian of retail endeavors, and what little profit there is depends largely on fobbing off a lot of the work onto customers. They drive to stores, pick and pack the inventory, bring it to the cash register, then haul it home. “Americans would like home delivery, but they aren’t willing to pay for it,” Mackey told me then.

While Mackey returned to brick-and-mortar retail in 2002, increasing sales nearly six-fold, Amazon leapfrogged from books and music to produce and diapers, and built a subscription-delivery service called Prime. Sales grew 35-fold over the past 15 years, and it became one of the most highly valued public companies.