(Bloomberg) --

Earlier this week, a French court, responding to union complaints that Amazon.com Inc. wasn’t doing enough to protect warehouse workers during the pandemic, ordered the company to stop selling nonessential items there. Saying it had invested in “additional safety measures to keep our hard-working, dedicated colleagues safe” and calling the ruling too vague, Amazon responded by closing its operations in the country pending an appeal.

Meanwhile in the U.S., where worker protests have popped up regularly, Amazon has so far largely avoided such restrictions. It’s true the company has taken some steps—recently pared back—to prioritize essential products such as food and medical supplies. But while it takes Amazon more than a week to deliver a box of Cheerios and more than a month to get a package of toilet paper to customers, a 9-foot patio umbrella can be had in just a few days.

With thousands of small retailers closed, perhaps forever, and rivals such as Walmart Inc. forced to rope off nonessential sections in some of their stores, the world’s largest online retailer could emerge from the pandemic even stronger than before. Investors have driven Amazon shares to record highs this month, a bet that U.S. authorities will mostly leave the company alone, despite dozens of cases of Covid-19 among warehouse employee ranks.

“The government is deciding who the winners and losers are right now,” says Forrester analyst Sucharita Kodali. “Online demand is surging, and the big question is how much of this shift stays with Amazon when this is all over.”

Of course, running a complicated retail business during a pandemic is challenging. Surging online demand from spooked consumers has forced Amazon to staff up; the hiring of 175,000 people along with temporary pay raises is pushing up costs. The profitable advertising business is also taking a hit because those selling must-have products don’t need to promote them while those who carry slower sellers have curtailed their ad spending.

How much damage these headwinds will inflict on the bottom line will become clearer when Amazon reports results on April 30. But analysts seem willing to overlook a short-term blow to profitability since they expect the company to benefit from permanent changes in shopping behavior over the long haul. In a matter of months, the coronavirus has accelerated a consumer shift from physical to online stores that was expected to take years, according to Morgan Stanley analyst Brian Nowak.

That helps explain why some analysts have increased revenue estimates for this year and 2021 even though overall consumer spending is dropping. Meanwhile, with so many people video conferencing and streaming videos at home, demand is strong for Amazon Web Services, the hugely profitable cloud division.

Walmart and Amazon both have benefited from consumer spending during the pandemic, but Amazon has outpaced its rival throughout, says Randy Koch, who runs Facteus, which analyzes credit card and debit card transactions from millions of customers. “Amazon is growing at an incredible clip—well above Walmart,” Koch says.

Amazon’s edge over the big-box stores could widen since most of its sales are online. Department of Homeland Security guidelines defining which businesses are essential are further refined by governors in each state. Vermont and Michigan, for example, are among states that have asked Walmart and Target Corp. to close sections of their stores. The aim is to prevent crowding while letting big-box retailers stay open to sell groceries. Amazon has temporarily closed a handful of bookstores and other physical retail operations that have never generated much revenue.

Physical stores have to figure out complex rules that vary “state to state and minute to minute,” says Christy Campbell, a partner at the law firm Duane Morris who is helping retailers navigate the new environment. “Amazon doesn’t have to think about these different rules from state to state that are constantly changing,” she says. “That’s where online retailers are at a real advantage.”

Story continues