The Justice Department said Wednesday that Bank of America Corp. will pay a record fair lending settlement of $335 million to settle allegations that its Countrywide Financial unit discriminated against black and Hispanic borrowers during the housing boom.

Bank of America bought Countrywide in 2008 and has agreed to pay the settlement on Thursday, even though the bank’s mortgage lending arm denied any sort of discrimination in past lending patterns.

The payment will compensate “victims of Countrywide’s discrimination during a period when Countrywide originated millions of residential mortgage loans as one of the nation’s largest single- family mortgage lenders,” the Justice Department said in a statement on Wednesday.

“These institutions should make judgments based on applicants’ creditworthiness, not on the color of their skin. With today’s settlement, the federal government will ensure that the more than 200,000 African-American and Hispanic borrowers who were discriminated against by Countrywide will be entitled to compensation,” said Attorney General Eric Holder.

The department said that Countrywide loan officers and brokers had charged higher interest rates and fees to more than 200,000 minority borrowers compared to white borrowers who had the same credit history. The Department also alleged the company also directed more than 10,000 minority borrowers into high-priced subprime mortgages when these borrowers had similar credit histories compared to white borrowers who were given regular loans.

“Countrywide’s actions contributed to the housing crisis, hurt entire communities, and denied families access to the American dream,” said Thomas E. Perez, Assistant Attorney General for the Civil Rights Division.

“We are using every tool in our law enforcement arsenal, including some that were dormant for years, to go after institutions of all sizes that discriminated against families solely because of their race or national origin,” Perez added.

“We reached this settlement to resolve issues about Countrywide’s alleged historic practices that occurred before Bank of America acquired the company,” said bank spokesman Dan Frahm in a statement.

Frahm said that Bank of America’s practices were not an issue, and that BofA is committed to fair and equal treatment to all customers, adding that it “discontinued Countrywide products and practices that were not in keeping with our commitment and will continue to resolve and put behind us the remaining Countrywide issues.”

In 2008, it was reported by Bloomberg that Angelo Mozilo, co-founder of Countrywide, nearly “choked up” in a last shareholder meeting for Countrywide Financial, when he solemnly told them that BofA would “reap the benefits of what we have sowed.”

“Despite widespread and often unfounded headlines of the past year, Countrywide has made a positive impact on the country," Mozilo said, and added that Countrywide was the largest provider of mortgages to minorities and that some 22 million people had been able to buy homes thanks to the company, according to the report.