Earlier this year, when New York City Mayor Bill de Blasio tried to cap the growth of Uber and other ridesharing companies, he was forced to back down.

The public, it seems, likes the convenient and reliable services these companies offer. And it did not help the mayor’s cause that he had no evidence to support his singling out of Uber for Manhattan’s congestion woes.

But New York City is far from done in its quest to stifle transportation start-ups.

Having tried alternately to ban, oppressively regulate, and cap these companies, it now may be looking to a new angle of attack: Uber’s pricing model.

Ridesharing companies employ dynamic pricing to allow the fares they charge to fluctuate in response to real-time changes in demand. Uber calls this “surge pricing,” and Lyft refers to it as “prime time” pricing.

Regular riders with either service have undoubtedly experienced the travails of surge pricing, when a ride can cost two or even three times what it ordinarily would.

In New York, a bill before the city council would restrict surge pricing to 100 percent of the normal fare. Policymakers are calling the practice “price gouging” and want to protect consumers from it.

Riders, however, should not fall for this.

Surge pricing is undoubtedly one of the least popular elements of rideshares’ business models, but it is also one of the most critical. That combination makes it a prime target for politicians eager to protect their favored interests—the taxis—without incurring too much wrath from the growing ranks of Uber riders.

Why is surge pricing so important? One of the aspects of rideshares that make them so convenient is that a ride is seldom more than a few minutes away. Regardless of the time of day, a rider can have a car in front of him nearly immediately.

To accomplish this feat, rideshares have to ensure that the supply of drivers is always adequate to meet consumer demand. That means that they have to find a way to get drivers on the road at peak times, such as rush hour, during inclement weather or holidays, and during the wee hours of the morning after bars’ “last call.”

Uber and Lyft face a few obstacles in doing so. It turns out that the very times when they are needed most are the times when drivers least want to be on the road. Nobody wants to be driving at 3 o’clock in the morning, and most people prefer spending time with family to working over major holidays.

Some, no doubt, will want to work at these high times, when their potential earnings are highest, but this is not always the case.

Many drivers work toward a particular desired wage. Once they hit their goals for the day, they head home to relax and enjoy the fruits of their labors.

When demand increases, drivers can pick up more passengers in less time and hit their self-set quotas more quickly. Paradoxically, then, increased demand can actually decrease supply.

Uber drivers, just like everybody else, place a value on the time they spend not working. At some point, the cost of an extra hour of work outweighs the gain, and they do not want to work any longer.

Getting drivers to work during the times they may not otherwise want to requires a financial incentive that makes serving customers more economically valuable than their lost leisure. Hence surge pricing.

Raising fares turns out to provide just the incentive needed to overcome these problems.

At the same time, higher prices serve as a disincentive to riders, keeping the demand for cars in check. Riders who do not value a jaunt in an Uber or Lyft enough to pay the new price will find alternate forms of transportation or wait until later. Meanwhile, riders who do value the service, or who truly need it, can still get a car with the usual swiftness.

Compare that to the arduous process of trying to hail a cab or the lengthy waits for a dispatch taxi (if they show up at all) common to most major cities. Regulators generally impose strict supply and price controls on the taxi industry. There is no ability to adjust for changing demand, so shortages are common.

Without dynamic pricing, rideshares would likely suffer the same problems, and consumers—in whose name price controls are always enacted—would suffer as a consequence.

Dynamic pricing is by no means new. In fact, most consumers are intimately familiar with the concept. Hotels and airlines have been changing the prices of their offerings in response to demand for years, lowering prices when there is excess supply and raising them when the opposite is true.

Nobody expects an airline to charge the same price for its tickets today as it does tomorrow; nobody should expect Uber to charge the same price for a trip on a Sunday afternoon as it does during the height of the Monday morning rush hour.

Policymakers should avoid the impulse to bring innovative ridesharing companies under the same umbrella of price controls the taxi industry has been subjected to for more than 80 years.

Heavy-handed regulation has led to a calcified taxi industry that serves the interest of neither drivers nor consumers. It is absurd to believe that the results will be any better in the ridesharing context.

Surge pricing is not price gouging. It serves a simple, but necessary, purpose, and policymakers should leave it be.

In other words, they should put market economics in the driver’s seat.