Bank of America Corp. is in talks to pay at least $12 billion to settle civil probes by the Justice Department and a number of states into the bank's alleged handling of shoddy mortgages, an amount that could raise the government tab for the bank's precrisis conduct to more than $18 billion, according to people familiar with the negotiations.

At least $5 billion of that amount is expected to go toward consumer relief—consisting of help for homeowners in reducing principal amounts, reducing monthly payments and paying for...