Last week Amazon (AMZN) announced that it would acquire the embattled grocery chain Whole Foods (WFM), sending shockwaves through the investing world. While recent buyers of Whole Foods stock are probably quite pleased with their 30 percent gain from the deal, the owners of other grocery sellers got clobbered. Kroger (KR), the country’s largest grocery chain, shed 9 percent of its value just a day after plunging 19 percent. Smaller rival Supervalu (SVU) dropped 17 percent, while Dutch company Ahold Delhaize (ADRNY), the parent of several supermarkets including Food Lion and Giant, sank 8 percent. Discount retailers Walmart (WMT) and Target (TGT) lost 4.6 and 5 percent, respectively.

Few could have seen this coming, but the marriage makes a lot of sense when you think about it. It is no secret that Amazon wants a bigger slice of the grocery business, and the Whole Foods buyout gives them a huge national footprint to work with. Rumor has it that Amazon plans a campaign of massive price cuts in order to dispense with the “Whole Paycheck” image that has weighed down the supermarket chain. For its part, Whole Foods can rid itself of the pressure of being a public company and gain the long-term economic protection that Amazon can provide.

On its face, the Whole Foods deal looks like a colossal threat to the companies that experienced large selloffs on Friday. Commentators have framed the competition between Walmart and Amazon as an epic showdown akin to the future collision of the Milky Way and Andromeda galaxies, a winner-take-all game where every retailer in between will be trampled into irrelevance. But as with most matters, the reality is a bit more complicated.

For one, Amazon and Whole Foods likely share many of the same customers, since both companies are concentrated in affluent urban areas. This seems to be the most likely explanation for Amazon buying Whole Foods over some other grocery chain, and is yet another reason why Bezos’ latest move is a masterstroke. To illustrate this point, I searched for Whole Foods stores in the Greater Boston area, which is where I live.

This snapshot probably misses a few stores, but the gist is accurate. Whole Foods stores are clearly concentrated in Boston and its densely-populated immediate suburbs. The outliers that you see are mostly located in high-income communities such as Bedford and Andover. For grocery store chains such as Delhaize-owned Stop and Shop, the Whole Foods deal is probably disturbing. Stop and Shop functions as a mid-tier market that also targets more affluent consumers, and unfortunately they now compete directly with Amazon in much of their Massachusetts territory.

For retailers who focus on markets outside the city, however, this development is not a death knell. Take Walmart, which rose to power by dominating retailing in rural and suburban America. The core Walmart shopper is attracted by the plethora of goods with rock-bottom prices; indeed, nearly 20 percent of U.S. food stamp dollars are spent at the company. This strategy is the exact opposite of Amazon’s approach, which benefits from recent growth in rich urban centers where its business model works best. Using Greater Boston again as an example, the contrast becomes more obvious.

Here we can see that Walmart has few stores around Boston’s outskirts, and no stores in Boston proper at all. Instead they are concentrated in working-class suburbs such as Saugus and Lynn, as well as poor cities to the north like Lawrence and Lowell.

The main takeaway from this analysis is that investors should look to which companies intersect the most with the now Amazon-owned Whole Foods. If Walmart and Amazon could be viewed as concentric circles, then we probably would not see a lot of overlap, at least in terms of locations and customers. Both companies have tried to encroach on one another’s territory, but only at the margins. As usual, the guys in the middle will probably feel the most pressure. Mid-market chains with no competitive advantages in either price or quality will likely suffer, while discounters and others who do business away from cities will still do well. Investors who are considering buying stock in companies that compete with Walmart and Amazon ought to take a hard look at customer overlap before pulling the trigger.