Hundreds of millions of dollars in mortgage-fraud settlements from JPMorgan Chase & Co. and other banks are providing a windfall to state attorneys general—and creating a new class of political winners and losers.

In New York, Attorney General Eric Schneiderman learned in November his office was getting $613 million from JPMorgan, about triple his annual budget. He said he’d use the cash to reimburse victims and finance investigations. Governor Andrew Cuomo, a fellow Democrat, questioned Schneiderman’s hold on the money and a dispute over the cash ensued.

California Attorney General Kamala Harris, seen by some as a potential gubernatorial candidate in 2018, used her $300 million share from JPMorgan to reimburse public-pension funds for losses on mortgage investments. Lisa Madigan, her Democratic counterpart in Illinois who considered a run for governor this year, applied her $100 million share to the state’s pension systems, which face a worst-in-the-nation $100 billion shortfall. She trumpeted her move with a news release.

“Politics is all about money and power,” said Peter Henning, a former lawyer with the Securities and Exchange Commission and a professor at Wayne State University Law School who has written about the JPMorgan settlement. “AG stands for almost governor.”

In November 2013, the U.S. and five state attorneys general reached an agreement with the bank that it would pay $13 billion to settle claims that it sold risky mortgage securities. JPMorgan, admitting that it and companies it bought hadn’t sufficiently informed investors about risks, paid a $2 billion civil penalty. It also paid almost $6 billion to resolve lawsuits by the Federal Housing Finance Agency, the National Credit Union Administration and the Federal Deposit Insurance Corp.

New York got $613 million to settle a 2012 case Schneiderman mounted against the bank and its Bear Stearns unit. As the most active in pursuing—and suing—the bank, he won the biggest pot. That was enough to aggravate natural tensions with the state’s top political figure.

“When the settlement gets big enough, you have a fight,” said James Tierney, a former Maine attorney general who runs a program about the position in Columbia University’s law program. “Both bring to the table the legitimate functions of their office.”

The stakes were heightened by another reality: the past two governors, Cuomo and Eliot Spitzer, were elected after taking on Wall Street institutions as attorneys general.

“It’s counterintuitive, but the chance for sparks to fly is greater when the governor and attorney general are from the same party,” said former New York Attorney General Bob Abrams, who is now a partner with Stroock LLP in New York. “There is a natural suspicion and paranoia, and there can be competing ambitions.”

Such rivalries have been going on for decades, said Tierney, a key adviser in the $246 billion settlement among the tobacco industry, the U.S. government and 46 attorneys general in 1998.

In the 15 years since, governors used the money for bridges, tax relief and other purposes not related to tobacco control or health that the attorneys general had proposed.

“A lot of public officials at the time made some grandiose promises about spending the money on tobacco prevention and health,” Fisher said. “The reality turned out to be quite different.”

In later deals, the attorneys general protected their plans. In February 2012, the U.S. and 49 attorneys general reached a $25 billion settlement with five top mortgage servicers, including Bank of America Corp., whom they accused of signing foreclosure documents without verifying them.

The servicers were told to use as much as $21.5 billion to cut homeowners’ principal payments, refinance loans at lower rates and compensate 2 million people who lost their homes because of malfeasance. Money going directly to the states would protect consumers against foreclosures.

Schneiderman structured New York’s share of the JPMorgan agreement to give his office broad powers to determine how the funds would be spent, according to the settlement.

The original deal gave Schneiderman control of 85%, with 15% going to the state treasury. It said he could use the funds to aid those hurt by the foreclosure crisis and “otherwise promote the interests of the investing public.” He could spend money on housing counselors, mediation, and anti-blight projects, the settlement said.

Cuomo balked and argued with Schneiderman that the money is meant to relieve all taxpayers, and the attorney general isn’t allowed under state law to spend it as he sees fit, according to an administration official familiar with the discussions who requested anonymity because the dispute was private.

Schneiderman and Cuomo worked out the dispute over the first $163 million installment of the four-year payout just before the governor announced his state budget Jan. 21. The attorney general will put half into the treasury, and Cuomo and the legislature will spend it on housing. Schneiderman also agreed to go through the state contracting process and the oversight that comes with it when spending the funds.