Weak same-store sales in July have analysts questioning whether the tepid recovery in restaurants is over. After rising slightly in May and June, it appeared the industry was finally regaining its footing, but now that sales have turned south again, it may be that what's affecting retail in general is now spreading to restaurants. In short, Amazon.com (NASDAQ:AMZN) may be weighing heavily on dining out.

No seat at the table

For all the hopefulness surrounding the two-month rise in comps, fewer people are still eating out, and it doesn't matter if it's fast food or casual dining chains. Customer traffic is down and has been for the last 17 months, and for 21 of the past 22.

Friends dining out at restaurant

Image source: Getty Images.

Restaurants have been subsisting on rising prices and product mix to sustain any growth, though McDonald's (NYSE:MCD) was a rare case of enjoying a 3.9% rise in comps for the second quarter that also consisted of a 1.8% rise in guest count. However, for the first six months of 2017, the burger joint's customer traffic is only 0.3% higher than a year ago, and while that could suggest growth, McDonald's has been down this path before.

A year ago, customer traffic was also higher at this time, but it turned negative again in the third quarter and McDonald's ended the year at a loss, the fourth straight year it had lost customers. It seems hard to imagine it won't happen again this year for a fifth consecutive year.

Chart of McDonald's comps and YTD guest counts

Data source: McDonald's quarterly SEC filings. Chart by author.

Of course, it's not just McDonald's as Wendy's (NASDAQ:WEN) said its customer count was down for the quarter despite the 3% increase in comps.

The second quarter was largely better for fast-food chains than casual dining restaurants, which even absent Chipotle Mexican Grill (NYSE:CMG), which continues to have major sales issues, comps were down at publicly traded chains by 2%.

So the sudden downturn the industry experienced in July caught everyone off guard. Even two-year comps -- figures that tend to smooth out things like weather-related events -- were down 0.7%, the first time in more than three years the metric fell and Nation's Restaurant News says it was the worst performance in six years.

Every day is Christmas

Thus it may not be a coincidence Amazon.com held its Prime Day sales extravaganza in July. The e-commerce giant raked in more sales on July 10 than ever before, even surpassing Black Friday and Cyber Monday. Sales soared 60% above those made during last year's Prime Day event and 50% more Prime members made purchases this year than last.

That's key because there would seem to be a correlation between people going out to malls to go shopping and the business restaurants do. Rather than having to go home and cook a meal, grabbing a bite to eat while out seems easier. It's undoubtedly why so many restaurants are located so close to major retailers.

Friends shopping at the mall

Image source: Getty Images.

Even grocery stores have noticed the relationship, and though price deflation is having an impact on whether people will cook at home or dine in, more supermarkets are adding in-store restaurants to keep customers around.

So when consumers no longer have to leave the comfort of their home to do their shopping, they're going to eat out less. A few years ago, Starbucks' (NASDAQ:SBUX) Howard Schultz acknowledged the role e-commerce was having on sales at the coffee shop and elsewhere, and not just during the Christmas season.

"This is going to be an ongoing issue," Schultz told analysts on Starbucks' conference call at the time, "and it's going to happen faster than people think in terms of the way people are shopping and how they are spending their time, and the value that you can get on the web."

Yet unlike retailers, restaurants don't look to the holiday shopping season to make their annual numbers, even if they still enjoy some of their strongest profits of the year during that period. But with e-commerce now becoming ever more commonplace throughout the entire year, restaurants may begin to feel the Amazon Effect just as acutely as retailers regardless of the season and Amazon.com may start taking a greater toll on dining out as it has with other retailers.