Wells Fargo is the nation's largest residential home mortgage originator.

NEW YORK (CNNMoney) -- Wells Fargo has agreed to pay $175 million to settle allegations that it discriminated against minority borrowers, the Department of Justice announced Thursday.

The DOJ accused Wells Fargo, the nation's largest residential home mortgage originator, of pushing African-American and Hispanic borrowers into more costly subprime loans or charging them higher fees than comparable white borrowers. More than 30,000 minority borrowers between 2004 and 2009 were affected, the Justice Department said.









"If you were African-American or Latino, you were more likely to be placed in a subprime loan or pay more for your mortgage loan, even though you were qualified and deserved better treatment," Assistant Attorney General Thomas Perez said in prepared remarks Thursday.

"This is a case about real people -- African-American and Latino -- who suffered real harm as a result of Wells Fargo's discriminatory lending practices."

In 2007, for example, a typical African-American wholesale borrower in Chicago seeking a $300,000 loan from Wells Fargo paid nearly $3,000 more in fees than a similarly qualified white applicant, the Justice Department said.

Wells Fargo (WFC, Fortune 500) denied the government's allegations, saying it agreed to settle the case "solely for the purpose of avoiding contested litigation."

"Wells Fargo is settling this matter because we believe it is in the best interest of our team members, customers, communities and investors to avoid a long and costly legal fight, and to instead devote our resources to continuing to contribute to the country's housing recovery," Mike Heid, president of Wells Fargo Home Mortgage, said in a statement.

The company says it stopped all subprime lending in 2008, and has agreed to conduct an internal review of certain subprime mortgages issued during the period in question.

The settlement is still subject to court approval. As part of the agreement, Wells Fargo will pay $125 million in compensation to victims of discrimination, and $50 million in down-payment assistance to borrowers in affected communities.

In December, Bank of America (BAC, Fortune 500) paid $335 million in a settlement over similar practices at Countrywide Financial, which it bought in 2008. The Justice Department accused Countrywide of discriminating against at least 200,000 qualified African American and Latino borrowers from 2004 to 2008.