Renters came out winners under the new tax law.

For over a century, the federal tax code catered to homeowners and treated renters like second-class citizens. Homeowners have been able to deduct interest on their mortgages, home-equity loans and property taxes. Meanwhile, everyone — including renters — footed the bill for these deductions by paying higher rates.

The new tax law at last begins leveling the playing field between renters and homeowners.

Millions of New Yorkers and Californians will reap the benefits, because these states have among the lowest rates of homeownership in the nation. So ignore the hyperventilating from Democratic politicians that tax reform is a gift to the rich.

New York Sen. Chuck Schumer condemns the new tax law as “a gut shot to the middle class” while “rewarding the wealthiest among us.” The truth is just the opposite. Tax reform benefits renters, who often live in cities and tend to have lower incomes — a key Democratic constituency.

Under the new tax law, everyone — renters and homeowners alike — will have their tax rates cut and their standard deduction almost doubled. Most will end up paying less. To cover the cost of these cuts, the law caps the mortgage deduction for buyers of the priciest real estate.

Few home buyers will even notice it, because they’re not borrowing $750,000 or more. Last year, only 4 percent of home buyers borrowed that much, and only about 100,000 buyers will take out such huge mortgages in 2018.

Democrats are usually eager to slap taxes on millionaires. But now, they’re so desperate to discredit GOP tax reform that they’re defending deductions for the nation’s wealthiest homeowners in expensive East and West coast enclaves.

It’s true that the cap will likely hit the wallets of the bicoastal elite. Some 64 percent of buyers in Manhattan’s rarefied real-estate market took out a mortgage that big, and 58 percent of San Francisco buyers did.

But the tax change certainly won’t hurt middle-class first-time buyers. They purchase homes with a median price of $182,500. In the past, the tax code encouraged wealthy homeowners to buy even bigger homes and borrow more.

That’s great for the wealthy and the banks. Not much help for the average Joe.

Home ownership isn’t any higher than in the late 1960s — with only 64 percent of households owning their own home. For minorities, the goal is even farther out of reach, with only 42 percent of black families and 46 percent of Hispanic families owning their home. So disregard the partisan claim that lowering the cap on the mortgage interest deduction is going to hurt the middle class.

The other major deduction for homeowners has been property taxes. The new law puts a $10,000 lid on deducting all state and local taxes combined, whether income, sales or property taxes. Homeowners in most of the nation don’t have much to worry about.

Hardest hit are a few tony counties with multimillion-dollar homes like Westchester, where the average property tax tab is a whopping $15,000. For that, the streets should be paved with gold.

But only one-fifth of New York property owners pay over $10,000, and about 30 percent of New Jersey homeowners do.

Yet Schumer rants against the new tax law, claiming it hurts “middle-class and working families.” Baloney. Tax reform makes the tax code more progressive, not less. It imposes added costs on the wealthiest homeowners to fund across-the-board tax breaks for everyone. Including renters.

Homeowners still have the option of taking deductions for most mortgage interest and property taxes, but almost all will crunch the numbers and find it pays to take the nearly doubled standard deduction instead.

Only 5 percent of filers are expected to itemize.

California Gov. Jerry Brown calls the tax law “evil in the extreme.” That’s demagoguery. Most taxpayers will end up with more money in their wallets.

Betsy McCaughey is a senior fellow at the London Center for Policy Research.