It used to be that every time a bank sold a mortgage, the county land recording office received a fee. It wasn’t much-$30 or so-but then real estate boomed in the 1990s and banks pooled millions of mortgages into securities that investors bought and sold.

One mortgage transaction became a dozen or more, and the tab grew ever larger. So the banks came up with a way around the fees. And now they are fighting to avoid perhaps tens of billions of dollars in penalties that have added up over the years.