San Francisco is a cauldron of rights, unless you own a home.

Buy a property here and you might as well paint a target on your back. That's what Dan and Maria Levin discovered after they bought a two-unit North Beach home in 2008. They moved in to the upstairs one-bedroom apartment and told the downstairs tenant that they eventually planned to use the downstairs apartment for friends and family. (The state Ellis Act allows property owners to evict tenants without cause if they plan to take the property off the rental market.)

Five years later, the Levins served a notice of termination of tenancy and paid their tenant $2,600 -- the first half of a city-mandated relocation payment, with the second half due when the tenant moved out 120 days later. The tenant claimed a disability, which entitled her to a one-year extension and an extra $3,500.

Dan Levin told me the couple knew the rules and expected to pay off the tenant. They were OK with that. But the couple didn't expect what happened next.

In the spring, by a 9-2 vote, the San Francisco Board of Supervisors adopted an ordinance that "enhanced" the amount landlords would have to pay so it would compensate tenants for renting a comparable place for two years at market rates. Mayor Ed Lee didn't sign it, but with a veto-proof majority, it went into effect in June, even for cases already in the works. Factor in city rent control and the new ordinance can mean a big chunk of change. Suddenly, the Levins had to pay their tenant $118,000 to leave.

On Tuesday, U.S. District Judge Charles Breyer, a Bill Clinton appointee, found the ordinance unconstitutional. Breyer wrote that city law "requires an enormous payout untethered in both nature and amount to the social harm actually caused by the property owner's action." That is, the city wrongly is asking a handful of landowners to shoulder an unfair burden of the cost of an on-fire housing market.

No lie. The new San Francisco ordinance makes getting evicted akin to winning the lottery. There's nothing to stop the recipient from using the windfall funds for recreation -- or as a down payment on a property in a city that recognizes property rights. And without any needs test, Breyer wrote, "the ironic result" of the law is that "those tenants who can afford to pay the highest current monthly rents are entitled to a correspondingly higher payout amount." Two tenants who moved in to another building in 1997 and paid $8,500 per month in rent are now entitled to a payout of more than $220,000.

And then there's the fact that these huge new fees apply essentially retroactively. "I have talked to many people about this law, especially non-lawyers, from all sides of the spectrum, and I haven't found one that thinks it's reasonable," said J. David Breemer, an attorney for the Pacific Legal Foundation, which is representing the Levins pro bono.

Supervisor David Campos, who sponsored the ordinance, disagrees -- and he's a Harvard Law School grad. When you consider "what landlords are making in this market," he said, the ordinance "makes sense. I believe that it's reasonable." Evicted tenants will have to spend money on housing elsewhere. To Campos, the issue is "not just how much money (the Levins are) paying but also how much money are they making in the sale of the property." Except they aren't planning to sell the property now.

The Levins' relocation payment, Campos added, presents a "most extreme case." Better to look at "a typical case." OK. The city controller's office computed a payout of $45,000 for a $900-per-month apartment. That's a lot of money to pay someone to move.

Breyer doesn't disagree that San Francisco has a housing problem. He just doesn't think it's fair to make the Levins pay six figures to atone for a market that is unaffordable for a host of reasons not of their making.

City Attorney Dennis Herrera will appeal Breyer's decision. Campos argues that the ordinance is not retroactive, as it applies only to uncompleted and future evictions. Breemer would counter that the ordinance upset the "legitimate expectations" of property owners by levying an "exorbitant" cost without proper notice.

It came like a bomb you couldn't hear until after it landed.

I asked Levin about his politics. "I'm a lifelong Democrat myself," he told me. "My wife is, too. We vote that way." It bothers the couple that there's no means-testing for tenants, that people with six-figure incomes enjoy a windfall that small-property owners can ill afford.

City Hall drove these Democrats into the loving arms of the usually conservative property rights crowd. Levin told me he doesn't think it's political; it's "a constitutional issue." Don't be so naive. In San Francisco, everything is political, especially the U.S. Constitution.