The state attorneys general of New York, New Jersey and Connecticut joined forces Wednesday, filing a new lawsuit against the Internal Revenue Service over a rule banning charitable contributions to state and local governments in exchange for tax write-offs.

The rules approved by the state were an attempt as a workaround to a few federal laws that limit to $10,000 the amount of state and local taxes residents can write off on their federal tax returns — known as the State and Local Tax deduction — or SALT.

Before the Tax Cuts and Jobs Act of 2017 was approved by President Trump and the GOP-led Congress, there was no cap on the amount of state and local taxes residents could deduct.

Many wealthier residents in the three states pay property and state and local income taxes that greatly exceed the $10,000 limit — so the cap hikes their taxes.

Gov. Andrew Cuomo announced a workaround in the form of charitable donations to state local governments — in order to boost New Yorkers’ deductions and reduce their tax liability to counter the SALT cap.

But the IRS rejected the states’ schemes as invalid.

“The IRS’s move to end tax benefits for charitable giving is yet another attempt by the Trump Administration to unfairly target the hardworking taxpayers of states like New York,” New York Attorney General Letitia James said in a statement Wednesday.

“We will not stand idly by as this Administration throws out decades of historic precedent putting our local economies, education systems, and other critical public programs at risk. My office stands firm against this unlawful attack, and will do everything in our power to ensure that state taxpayers are protected.”

It’s the second suit filed by New York, the first directed at the repeal of the SALT cap.

“The Trump administration’s SALT policy is an economic civil war that helps red states at the expense of blue states. We have been ringing the alarm bell about this punitive tax policy for years, and New York led a group of states in filing a joint federal lawsuit challenging its constitutionality. That lawsuit is ongoing,” Cuomo said Wednesday.

The lawsuit was filed in the Southern District of New York.

Trump defended the SALT cap as part of a larger tax overhaul that cut federal corporate and income taxes. He urged New York and other high-tax states to cut their own taxes and spending.