Luis Alvarez/Associated Press

Lurking in a proposed mortgage fraud settlement with the state attorneys general is a clause that could be worth billions for the big banks.

Yes, I mean the settlement that might extract the supposedly large sum of $20 billion from the banks to settle foreclosure fraud. The one denounced as a “shakedown” by Senator Richard Shelby of Alabama.

Despite such rhetoric, the settlement might let the banks avoid tens of billions of write-downs, thanks to a clause with a biblical flavor: the last shall be first.

The proposed agreement — which is preliminary and subject to intense negotiations being led by Tom Miller, the attorney general of Iowa — would allow banks to treat second mortgages, like home equity lines of credit, just like the first mortgages. Under the proposal, when a bank writes the principal down on the first mortgage, the second should be written down “at least proportionately to the first.”

Suddenly, the banks would be given license to subvert the rules of payment hierarchy, as Gretchen Morgenson pointed out in The New York Times on Sunday. Yes, the clause says the other alternative is to wipe out the second’s value entirely, but given a choice, the banks would be extremely unlikely to do that.

So how is this a gift? Because when the principal on the first mortgage is reduced, the second lien is typically wiped out. The first lien holder has the first right to any money recovered, and the second lien holder has to wait its turn.

The proposal “seems astonishingly generous to the second-lien holders,” said Arthur Wilmarth, a law professor at George Washington University. “And who are those? Of course, they are the big mortgage servicers.”

And who owns the big mortgage servicers? The biggest banks.

Throughout the financial crisis, we have heard plenty of intoning about the sanctity of contracts. But this suggests that the banks, with the authorities’ tacit approval, think contracts are for thee and not for me. The price to get the banks to do the right thing contractually with mortgage modifications and foreclosure is to allow them to not do the right thing elsewhere.

To understand the significance of this issue, cast your mind back to the height of the housing bubble. People used their homes as A.T.M.’s, withdrawing billions from their equity to finance motorboats and meals at Applebee’s.

The top four banks now have about $408 billion worth of second liens on their balance sheets, according to Portales Partners, an independent research firm specializing in financial companies. Wells Fargo, for instance, has more money in second liens than it has tangible common equity, or the most solid form of capital. If banks had to write these loans down substantially, acknowledging the true extent of their losses, they would have to raise capital — and might even teeter on the brink of insolvency.

The performance of second liens is among the biggest puzzles in banking today: why are they doing better than the firsts? When Wells Fargo disclosed its earnings, for instance, it classified 5.3 percent of its first mortgages as nonperforming, but put only 2.4 percent of its second liens in that category. That seems very odd because it’s much easier to lose your home if you don’t pay your mortgage than if you don’t pay your home equity line.

Investors are deeply skeptical about the value in these loans, bidding about 50 cents on the dollar for them these days. Even allowing that banks probably hawk the least attractive loans and that investors bid low to generate a high return for the risk, many of these loans are still probably not worth 100 cents on the dollar.

Yet banks have taken relatively few write-downs on second loans so far. In fact, even when the first clearly is in trouble, sometimes the banks appear to resist writing loans down. Bill Frey, who runs Greenwich Financial Services, has instigated lawsuits to try to recoup the value of mortgage securities by getting the banks to buy back faulty mortgages that were in the pools he examined. He analyzed mortgage securities made up of loans by Countrywide Financial, which is now owned by Bank of America, looking for instances when the second lien was still extant, even though the first lien attached to the same property had been modified. Such a situation would suggest that a bank was not marking down a second lien even when the underlying, more senior first lien was impaired. He says he found multiple instances in every one of the 200 pools he examined.

Mr. Frey argues that the banks should charge off those seconds. “That’s the concept of subordination,” he said. “It’s been around since the Magna Carta. Maybe we should get on the bandwagon.”

This is not simply a fight between hedge funds, which own the securities that contain the first liens, and banks that house the seconds. Many mortgage securities are held by small banks, life insurance companies and pension funds. “I can see little reason why a pensioner should take the loss instead of Bank of America, when it’s Bank of America’s bad loan,” Mr. Frey said.

A Bank of America spokesman said that it charges off second loans when borrowers haven’t made payments for 180 days. The bank doesn’t, nor is it required to, charge them off just because the first lien has been modified, he says. But if a first mortgage is modified, the bank will increase its reserve because it’s more likely that the second will sour.

Since the fall, the Office of the Comptroller of the Currency has been examining how banks across the industry are treating their second liens, according to two people familiar with the review. The O.C.C. declined to comment.

But so far, the agency has evinced a rather blasé attitude about the potential problem on banks’ balance sheet. Don’t expect forceful action any time soon.

In this case, making the last first may mean that weak banks continue to inherit the earth.