“I’d love to live in San Francisco, but I don’t want to pay $750,000 to live in a closet.” That’s what I tell my introductory economics students when I discuss housing prices. I probably need to update it to $2 million or something like that.

Why? Why is housing so expensive in cities like San Francisco, Boston, New York? It’s expensive because demand is high and rising. It’s insanely expensive to live in San Francisco because practically everyone wants to live in San Francisco.

But that’s only half the story. Housing is also insanely expensive because supply isn’t rising very quickly.

When you have demand rising quickly and supply changing slowly, you get rising prices. So how do we fix it?

First, we need to take a very hard look at the rules making it very hard to supply new housing. As Thomas Sowell points out in a Hoover Institution interview, land-use restrictions make it “prohibitively expensive” to build new housing in a lot of places.

In a 2008 paper in the Southern Economic Journal, the economists Edward Glaeser and Kristina Tobio argue that since 1970, the ease of increasing the housing supply explains the explosive growth of “Sunbelt” cities like Houston, Atlanta, and Dallas (their published paper is here, an ungated policy brief explaining their finding is here).

Second, we need to take a very hard look at how our moral intuitions might cloud our judgment. Trade-offs are everywhere, and by forcing housing to be safer and more comfortable we necessarily make it more expensive. Just as people are willing to live in a mediocre school district or high-crime area to get cheaper housing, they might be willing to accept the risks associated with less-safe housing if it means cheaper housing. This is a hard pill to swallow, but it’s important to respect that choice.

Consider the “lodger evil” of the Progressive Era. According to the historians David T. and Linda Royster Beito, the term “referred to the practice of many urban families...to double up through subletting” so that they could “save on rent and earn extra income.” As the Beitos put it, “(t)he lodger evil was very much the trial-and-error creation of ordinary people and clashed head-on with the top-down approach of Progressive Era political elites.”

A tragic reality? Of course, but paraphrasing something I once heard from the economist David Henderson, we don’t make people better off by eliminating the choices they actually make.

Third, we need to look at the “rules about the rules,” or the constitutional political economy for which James M. Buchanan won the 1986 Nobel Prize, that makes it possible for people to enrich themselves at others’ expense—in this case, by making it easy for homeowners to increase the value of their own property in desirable areas by making it prohibitively expensive for others to build or move in. This is the NIMBY phenomenon—“not in my backyard”—that leads people to oppose new residential and commercial development.

But if property rights mean anything, they mean that my backyard is not your backyard—nor is your backyard mine.

A literal example illustrates. There’s an empty lot just across the alley from my backyard, situated between two houses the next street over. It’s entirely possible that the owner of that lot might build something I don’t like—a brutalist house painted hot pink, for example, or a halfway house for recovering drug addicts. But My Backyard ends at the property line. If I want a say in what ends up on that lot, I should buy the lot.

One might object that something like a halfway house or a hot pink brutalist monstrosity would generate negative externalities. I’m sympathetic to the argument (believe me: I’m looking at the trees on the lot as I type this). That risk, however, was reflected in the price of the house when we bought it. In that sense, we’ve already been “compensated” for negative spillovers that might emerge. If we’d wanted a lot of control over what our neighbors can do with their property, we could’ve bought a home in a gated community with a powerful Homeowners’ Association and lots of strict rules. We didn’t.

Housing is expensive for two basic reasons: high demand and low supply. There’s a solution, though: get rid of some of the rules making it so hard for people to supply new housing.