Everyone agrees the most attractive areas in California suffer from a housing crisis that calls for drastic action. The difficult question is deciding what should be done. Many of the challenges are embodied in the small California town of Mountain View, population 80,000, which should be basking in sunshine as the home of Google. But instead the town is mired in discord and controversy over a set of well-entrenched anti-growth policies concerning housing. The tight supply of housing has raised the price of the median home to about $1.4 million. Rents, too, have skyrocketed, resulting in the displacement of many long-term tenants—teachers, nurses, and tech employees—who have to endure long daily commutes to work or find jobs elsewhere. Mountain View is now the proud home to numerous mobile home parks, occupied by individuals who crave access to the city—and who reportedly drive Teslas and Mercedeses, no less—but who lack the means to purchase or rent ordinary housing.

The situation in Mountain View has provoked two distinct responses. The first of these was the approval on November 8 of Measure V, a rent control statute that turns Mountain View’s rental market into a regulated public utility, complete with its own five-member board. The ordinance exempts all units built after February 1, 1995. But for the covered units, it rolls back rents to their October 2015 levels, and then limits rent increases going forward to between 2 and 5 percent, with allowances for higher increases if justified by extraordinary costs. The tenant groups that support the statute seek, without explicit acknowledgement, to secure a massive wealth shift in their favor, without discouraging future development. In so doing, they ignore the costs to other potential residents who put a higher value on those units, which will lead to a misallocation of available units whose number is kept artificially low by a wide range of entry constraints. The administrative costs of running this system for their exclusive benefit will, moreover, be borne by everyone inside the city. It is also likely that the threat of a new rent control law will weigh heavily on the market for exempt units, and will retard the ability to build new units as well.

That last possibility is the subject of an intense struggle between Mountain View’s pro- and anti-growth factions. Generally, pro-growth forces have made gains in California leading to a new YIMBY (Yes, in my Back Yard) movement. And new pro-growth members of the Mountain View City Council have spurred proposals to add about 10,000 new units—roughly 50 percent of the current total housing stock—to provide homes for Google employees. The politics around this proposal are intense, because new housing projects bring new tenants whose children will need to be educated in local schools, funded in part by local property tax dollars, some of which might come from existing tenants. Yet the construction of new office buildings and other facilities, which avoids this educational burden, will only aggravate the mismatch between jobs and homes in the area, further intensifying the housing shortage.

So the questions are: What caused this housing crisis, and what can be done to dig California communities like Mountain View out of their giant housing holes?

On the first question, it should be noted that similar issues occur from time to time outside of California, but usually with far less severity. The explanation for the situation lies in the heavy hand of government regulation on the operation of housing markets through tools like zoning and rent control laws, endless permitting requirements, and a host of other restrictions that go far beyond what is needed to control the health and safety risks associated with real estate development. Of course, real estate markets need some form of external regulation. But the particular form makes all the difference.

On this score, the traditional small-government approach could still work today. The first system of social control is the law of nuisance that prevents landowners from engaging in activities that are offensive to their neighbors, like the emission of filth, noises, and odors. These restrictions are efficient because they imitate standard restrictions always included in all forms of planned-unit developments, whether they be apartment complexes or gated communities. The initial owner of the property knows that his gain from selling or leasing is far greater if all owners are subject to these restrictions than if none are. The owner therefore “internalizes the externalities,” to use a term of art, by picking the optimal set of rules to regulate these risks. There is no conflict between his welfare and that of his buyers. The law of nuisance backstops these rules by protecting outsiders from the combined activities of the new project.

Every standard voluntary development goes far beyond the prevention of nuisances by imposing a set of covenants and restrictions that address such matters as setbacks, height restrictions, aesthetics, common areas, taxation, governance, and many other details. These tend to differ across developments based on the income, tastes, and preferences of the unit owners. But the same logic drives them to efficient outcomes. Any benefit given to one tenant is a restriction on the others. The optimal set of rules continues to maximize the difference between total benefits and total costs, and the entire arrangement “runs with” the land so as to preserve the basic governance structure as individual units are bought and sold.

What is striking about the system of public restraints in California is that they go far beyond the various covenants and conditions that developers devise for their own projects. And they do so in ways that benefit local residents by imposing crushing costs on new arrivals. At this point, the self-balancing mechanism that constrains the behavior of developers is removed, now that local homeowners and voters are given a free hand in how they regulate, because they never have to compensate current landowners or future buyers and tenants for the losses these restrictions impose. Local citizens are prepared to consume a lot of goodies at zero price, which is all that an emaciated takings law now requires of them. At this point, they only cast their ballots for particular restrictions that benefit themselves, no matter what the cost to future members of their community. “Welcome stranger” and “not in my backyard” become the order of the day, so each small community adopts rules that keeps out any new activity that sitting tenants think will lower the value of their own units. Let them build elsewhere is the modern equivalent to Marie Antoinette’s “let them eat cake.”

The correct way to deal with this problem is to impose a serious compensation requirement on the communities that implement these regulations so that the prices they impose on others are now borne by themselves. This elaborate system of takings law should not, of course, require that communities compensate landowners that engage in noxious activities. But by the same token, it requires a strong sense of discipline to make sure that feigned “nuisances” do not justify the full range of large-lot and height restrictions, setbacks, and the like that local communities routinely impose on new arrivals. All too often, the result is an endless back and forth in which developers challenge one set of restrictions, only to find that they have to go back to square one when the plan is rejected by the local planning board. Under current law, the aggrieved landowner cannot oppose these restrictions in court until internal administrative procedures are exhausted, which gives local governments the incentive to string out the process until developers die from financial exhaustion. The endless cycles of application and denial are ample warning to potential developers who become reluctant to buy land, develop plans, and go through endless hearing cycles before obtaining—often from multiple independent bodies—their precious permits. The potential residents that they represent are typically unheard in these proceedings. In similar fashion, the rent control laws generate an enormous wealth transfer to sitting tenants, which, over time, leads to a stagnation in real estate markets, as people hold on to their units knowing they cannot afford the higher prices available to them in the limited unregulated market.

This two-tier system creates massive inequities, which then inspires local governments to try to supply affordable housing to newcomers in ways that are routinely self-destructive. California is a national leader in this institutional folly, because its Supreme Court routinely upholds rules that act as strong barriers to entry. Thus in San Remo v. San Francisco (2002), it upheld a law that required a developer—who wanted to convert prime downtown property into a hotel—to supply substitute housing to sitting tenants, even after their leases had expired, or contribute to an “in lieu” fund that could be used to create new public housing. This senseless tax on conversion prevents the movement of property to higher value uses and thus shrinks the tax base. If a city wants to supply affordable housing programs, it can do so through general appropriations that make taxpayers take the hit for the generosity.

The situation got even worse in California Building Industry Association v. City of San Jose (2015), where a unanimous California Supreme Court held that all builders of new housing had to supply a fraction of affordable housing units at their own expense, even if their proposed plans displace no sitting tenants. The net effect of this convoluted price control system is to retard new development. Again, putting these costs on the taxpayers is the only way to break the logjam. We can be confident that the number of affordable units demanded will shrink because the expenditures will now be on-budget. But, at the same, time the total supply of housing should expand by increasing new entry, which will drive down overall price and rental levels.

At this point, it becomes clear why any Mountain View growth plan will be mired in controversy for years to come. The City Council has full discretion over what kinds of restrictions it can put on new units, and its combined weight will delay the housing relief, increase its costs, and reduce its benefits. What is needed is a systematic way out of the impasse. The first component of this program is to remove any and all permit restrictions on housing that are not related to public health and safety, narrowly defined as under traditional nuisance law. On this model, virtually every development will pass muster, and the key task of the planning commission is to make sure that vehicular access and off-street parking are properly supplied. Otherwise, the regulation stops.

More importantly, Mountain View and other towns have vacant areas and these should be regulated by a simple rule that lets the developer make all decisions inside that area on issues involving density, design, and governance. At this point, the older logic of land use restrictions can go into place. Supply will increase, and prices will go down. Where current citizens want to impose further restrictions, they can do so if they are prepared to pay for them.

The way out is therefore available. But how is that transition to be secured in the face of implacable local opposition? Local governments have no incentive to reform themselves. The California Supreme Court is so convinced of the wisdom of local governments that it will not impose any meaningful restrictions on their operations. The state is thus locked in by bad laws and bad institutions. Ironically, one of the only possible solutions to this blue state problem will come from a potentially remade conservative Supreme Court, which will likely enforce federal constitutional guarantees on takings and due process against California and its local governments.

That process will take time, and it will require the U.S. Supreme Court to recognize that it, too, has to mend its ways. But the populist wave that brought Donald Trump to power may yet protect California from its ingrained regulatory system. The incredible mess in the California housing markets is not a product of bad luck. It is the consequence of horrible laws whose destructive impact is all too evident in the daily hardship and senseless political battles now raging across the state.