In 2008 Brian Chesky and Joe Gebbia were having difficulty paying the rent for their loft in San Francisco. A large conference was coming to town and the hotels were filled. Recognizing an opportunity to make ends meet, the pair converted their living room into a bed-and-breakfast, offering up to three guests an air mattress and morning meal in exchange for some cash.

“I remember seeing on their websites that all the hotels were sold out. So we got the idea, why don’t we make our apartment into a little bed-and-breakfast?” Chesky said.

The pair made $1,000 that weekend—and paid their rent.

AirBed & Breakfast, or Airbnb, was born.

Along with a third cofounder, Nathan Blecharczyk, the company initially focused on large events in places where hotels were likely to be sold out. They wanted to provide a variety of lodging, booking anything “from a tent to a castle” at any price point.

The idea took off. Airbnb’s online lodging platform has allowed people to make money renting their homes and other properties for various periods. According to the company’s website, Airbnb has arranged for more than 25 million people to visit more than 34,000 cities in 190 countries. The site boasts over 1 million lodging options worldwide.

Despite this overwhelming success, Airbnb has met significant resistance. In Louisville, Kentucky, for example, property owners renting their homes through Airbnb recently received cease-and-desist orders from the local government claiming they were running illegal hotels. The city could fine the owners up to $500 per day if they don’t stop renting their spaces.

Why would the city of Louisville and others want to ban such a popular service?

Some claim it’s an issue of safety both for guests and hosts, since Airbnb isn’t regulated by the government as hotels are. But Airbnb strives to ensure safety for all concerned. The website requires guests and hosts to verify their identities by connecting their social networks and scanning their official IDs—that’s more than you get from the local motel operator.

Moreover, the system operates on a peer-to-peer review system. Guests and hosts review one another. But unlike with a hotel, for which anyone can submit a review, Airbnb renters and hosts can only review their experiences after a confirmed stay.

This provides future guests and hosts key information, enhancing their safety.

Before we assume that the government crackdown on Airbnb comes from genuine concern about safety, we should consider some other, less benevolent motives.

First, many state and local governments have turned to hotel taxes to pad their budgets. Travelers can pay a tax up to 17 percent of the cost of their hotel room. Airbnb threatens this revenue stream, giving government officials an incentive to shut it down.

Second, and not surprisingly, many hotels staunchly oppose Airbnb. Since the company provides a competitive alternative, hotels have a strong interest in hampering its operation or blocking its growth.

The threat is significant. Last year The Economist magazine stated that Airbnb could reduce hotel revenues as much as 10 percent. Recognizing this threat, hotels are lobbying elected officials for policies to protect their interests.

In fact, the American Hotel & Lodging Association spent over $1 million in lobbying last year, including a variety of attempts to legally disrupt or dismantle Airbnb’s business at state and local levels.

The losers from banning or impeding Airbnb and other innovative services, such as ride-booking services Uber and Lyft, are consumers and producers. The 25 million transactions facilitated by Airbnb were undertaken because guests and hosts believed they would be better off.

Politicians deny individuals this choice not because it benefits those individuals, but because it benefits the politicians themselves. Letting the market operate freely would make producers and consumers better off, but it would anger sources of political support and threaten government coffers.

If we choose to visit a city, we don’t ask the government what we should see, where we should dine or how we should travel. Likewise, government has no business telling us where we should lay our heads at night.

Let’s keep government out of the bedroom, even if we’re renting it for only an evening.