THERE WASN’T much Martha Coakley could do about the massive pipe break that left dozens of Greater Boston towns without clean drinking water over the weekend. So she kept herself busy instead lecturing vendors not to increase the price of the bottled water that tens of thousands of consumers were suddenly in a frenzy to buy.

“We have begun hearing anecdotal reports of the possible price gouging of store-bought water,’’ Coakley announced Sunday. “Businesses and individuals cannot and should not take advantage of this public emergency to unfairly charge consumers . . . for water.’’ Inspectors were being dispatched, “spot-checks’’ were being conducted, and “if we discover that businesses are engaging in price gouging,’’ she warned, “we will take appropriate legal action.’’

Governor Deval Patrick got into the act, too. He ordered the state’s Division of Standards to “closely monitor bottled water prices’’ in the area affected by the water emergency. “There is never an excuse for taking advantage of consumers,’’ he intoned, “especially not during times like this.’’

It never fails. No sooner does some calamity trigger an urgent need for basic resources than self-righteous voices are raised to denounce the amazingly efficient system that stimulates suppliers to speed those resources to the people who need them. That system is the free market’s price mechanism — the fluctuation of prices because of changes in supply and demand.

When the demand for bottled water goes through the roof — which is another way of saying that bottled water has become (relatively) scarce — the price of water quickly rises in response. That price spike may be annoying, but it’s not nearly as annoying as being unable to find water for sale at any price. Rising prices help keep limited quantities from vanishing today, while increasing the odds of fresh supplies arriving tomorrow.

It is easy to demonize vendors who charge what the market will bear following a catastrophe. “After storm come the vultures’’ USA Today memorably headlined a story about the price hikes that followed Hurricane Charley in Florida in 2004. Coakley hasn’t called anybody a vulture, at least not yet, but her office has dedicated a telephone hotline and is encouraging the public to drop a dime on “price gougers.’’

Before you drop that dime, though, consider who really serves the public interest — the merchant who boosts his price during a crisis, or the merchant who refuses to?

A thought experiment: A massive pipe ruptures, tap water grows undrinkable, and consumers rush to buy bottled water from the only two vendors who sell it. Vendor A, not wanting to annoy the governor and attorney general, leaves the price of his water unchanged at 69 cents a bottle. Vendor B, who is more interested in doing business than truckling to politicians, more than quadruples his price to $2.99.

You don’t need an economics textbook to know what happens next.

Customers descend on Vendor A in droves, loading up on his 69-cent water. Within hours his entire stock has been cleaned out, and subsequent customers are turned away empty-handed. At Vendor B’s, on the other hand, sales of water are slower and there is a lot of grumbling about the high price. But even late-arriving customers are able to buy the water they need — and almost no one buys more than he truly needs.

When demand intensifies, prices rise. And as prices rise, suppliers work harder to meet demand. The same Globe story that reported yesterday on Coakley’s “price-gouging’’ statement reported as well on the lengths to which bottlers and retailers were going to get more water into customers’ hands.

“Suppliers worked overtime, pumping up production at regional bottling facilities and coordinating deliveries,’’ reporter Erin Ailworth noted. Polar Beverages in Worcester, for example, “had emptied out its plant in the city last night and trucked in loads of water from its New York facility.’’

Letting prices rise freely isn’t the only possible response to a sudden shortage. Government rationing is an option, and so are price controls — assuming you don’t object to the inevitable corruption, long lines, and black market. Better by far to let prices rise and fall freely. That isn’t “gouging,’’ but plain good sense — and the best method yet devised for allocating goods and services among free men and women.

Jeff Jacoby can be reached at jacoby@globe.com.

© Copyright 2010 Globe Newspaper Company.