America’s biggest mortgage servicers are closing in on a deal with federal and state officials to settle some of the thorniest foreclosure fiasco problems — including the robo-signing issue, The Post has learned.

The proposed settlement with the Department of Justice and 50 state attorneys general, once thought to be in the neighborhood of $20 billion, could range as high as $25 billion and include a provision for principal reduction, sources close to the discussions said.

The settlement, as it is now structured, would form two types of funds, one national and state funds for each of the states, and would settle most state and federal civil foreclosure claims against Bank of America, JPMorgan Chase, Wells Fargo, Citigroup and Ally Financial.

The settlement could be announced in the next few weeks, sources added.

While the talks are well advanced, those close to the matter warned that they could still become derailed as federal, state and bank representatives haggle over details, sources said.

The whopping $55 billion to $60 billion proposed payout includes restitution as well as penalty contributions from banks to state and national funds to settle claims of fraudulent mortgage practices like robo-signing — where paperwork was processed with improper signatures.

“The banks are negotiating in good faith, and we’re making a lot of progress,” said Geoff Greenwood, a spokesman for Iowa AG Tom Miller.

It is likely that banks will pay civil penalties in proportion to the extent of mortgage carnage they’ve allegedly committed, sources say.

Banks are also expected to agree to a raft of fixes to their mortgage servicing platforms that may overlap with changes under a so-called “consent order” already mandated by the Office of The Comptroller of the Currency.

State regulators will be allowed the flexibility to use funds contributed to the state funds to help modify underwater home mortgages based on what they believe is most effective in their states.

The national fund would offer the possibility of so-called principal reductions by lowering the principal amount a borrower has to pay, since many of the homes that have been foreclosed on are worth less than they were when originally purchased, due to cratering of home prices over the past four years.

The practice of principal reductions has been a controversial element of talks with the banks and regulators, with even some of AGs voicing concerns that such practices might encourage homeowners in good standing with their banks to default on loans to get state or federal aid.

Another sticking point being hashed over is mortgage servicers pushing to get absolved of any further legal claims by the state officials.