(Bloomberg News) -- Bank of America Corp. will pay a record $335 million to compensate Countrywide Financial Corp. borrowers who were charged more for home loans based on race and national origin.

Countrywide, acquired by Bank of America in 2008, assessed higher fees and interest rates to more than 200,000 black and Hispanic borrowers, the U.S. Department of Justice said yesterday in a statement. The lender also steered minorities into higher-cost subprime mortgages from 2004 to 2007, even when they qualified for prime loans, the agency said.

The penalty for Bank of America, the second-largest U.S. lender by deposits, dwarfs the $30 million total for all previous fair-lending settlements extracted by the agency, including $6.1 million paid last year by American International Group Inc. The Obama administration has boosted scrutiny of banks to discourage loan discrimination after the housing bust led to record defaults.

"This is huge," said Warren W. Traiger, a lawyer at New York-based BuckleySandler LLP who advises financial firms on fair lending. "While lenders need to be concerned about the activities of the civil-rights division of the Justice Department, the magnitude of this flows from a unique set of facts. Countrywide was a driver of the subprime debacle and helped create the Great Recession."

The review covered 2.5 million loans, including data on terms and creditworthiness of borrowers, according to the Justice Department. The agency said Calabasas, California-based Countrywide allowed loan officers and brokers to vary interest rates and fees, and knew it was discriminating against minorities. Whites with similar credit profiles received prime loans, according to the statement.

Bank of America Chief Executive Officer Brian T. Moynihan, 52, is cleaning up liabilities inherited with the takeover of Countrywide that was engineered by his predecessor, Kenneth D. Lewis. The Charlotte, North Carolina-based bank has committed about $40 billion for mortgage refunds, lawsuits and foreclosures since 2007.

"We will not hesitate to hold financial institutions accountable, including one of the nation's largest," Attorney General Eric Holder said in the statement. "These institutions should make judgments based on applicants' creditworthiness, not on the color of their skin."

The "alleged historic practices" of Countrywide predate its purchase by Bank of America, and the firm discontinued Countrywide products and practices it didn't agree with, said Dan Frahm, a company spokesman, in an e-mail. "We are committed to fair and equal treatment of all our customers."