It didn’t take long. It usually doesn’t. Even before consumers were raiding California stores the attorney general threatened sellers who raised prices by more than 10% with “one-year imprisonment in county jail and/or a fine of up to $10,000.”

Governments routinely warn sellers they will be prosecuted if they increase prices during emergencies. And they are, every time, wrong to do so.

Enforcing anti-price gouging laws, says Xavier Becerra, “protects people impacted by an emergency from illegal price gouging on medical supplies, food, gas, and other essential supplies.” County prosecutors and other elected officials have followed Becerra and issued their own warnings.

Rather than protect consumers, anti-price gouging laws harm them. They remove an essential cog of market mechanisms: price signals. Without them, markets can’t work, because, says the St. Louis Fed, they “communicate in such a way that prevents massive shortages and surpluses and ensures that consumer wants are largely satisfied.”

“The unintended consequence? There’s a roll of toilet paper or a bottle of hand sanitizer waiting for the next person who wants it at the market price.”

Price signals are clear messages indicating where goods are needed most. If plywood can sell for twice its usual market price in a coastal zone in the path of a hurricane, lumber companies will saturate the market. But if prices are capped by government, supplies can sell out before the demand is met, leaving some consumers without.

No one wants to pay two or three (or even four) times what the same package of toilet paper cost before the panic buying set in. But those who didn’t get to the store until the shelves were cleaned out and walked away empty-handed would have been happier paying the higher costs than having to wonder if their current supply was going to last until the stores are stocked again.

Criminalizing price increases also discourages entrepreneurship that, if left alone, will in times of emergency provide sorely needed goods. One of the best and truly infuriating examples of how the harm caused by anti-price gouging laws isn’t merely theoretical but quite real is the story of John Shepperson.

In 2005, Shepperson bought 19 generators, took time off from his job, rented a truck and drove 600 miles from his home in Kentucky to Mississippi, where many of the victims of Hurricane Katrina were without power.

So that he could cover his costs, and make a profit, Shepperson planned to offer the generators for twice what he paid for them. But he never sold a single one. He was instead arrested, charged for price gouging, and held for four days.

The generators, badly needed by Mississippians who had no electricity, were confiscated, helping no one.

After the first weekend of panic buying, California stores had been stripped of paper goods, frozen foods, bread, canned goods, eggs, soap, and hand sanitizer. Even now empty shelves are not unusual.

While some shoppers stocked up, many have either had to go without or make multiple trips when only one was needed in just the recent past. Did the attorney general’s office protect them? No, it just made the situation worse with its threats to prosecute, because the laws limit “the ability of good people to do useful things,” says Michael L. Davis, who even considered writing “blessed be the price gougers” in 2017 when hurricanes were threatening America’s Gulf states.

Railing against exploiters and cracking down on profiteers is a politician’s delight. Lawmakers want the public to notice their outrage, to approve of their courageous stand on behalf of the little guy who would otherwise be ripped off by unethical corporations.

But invoking anti-price gouging laws is poor economics, and itself unethical. What’s virtuous about preventing a willing buyer from making a transaction with a willing seller that benefits both? Nothing. Yet causing hardships through thoughtless laws is morally acceptable to many. This needs to change.

Kerry Jackson is a fellow with the Center for California Reform at the Pacific Research Institute.