Under the Equal Credit Opportunity Act, creditors are prohibited from discriminating against loan applicants based on race or national origin. But that was a rule Toyota’s financing unit allegedly violated, resulting in thousands of African-American, Asian and Pacific Islander borrowers paying higher interest rates than their white counterparts. Now, in an effort to resolve charges filed by the Consumer Financial Protection Bureau, Toyota Motor Credit Corporation must pay $21.9 million to wronged consumers.

The CFPB announced Tuesday that, along with the Department of Justice, it had reached a deal with Toyota Motor Credit to provide restitution to borrowers and revamp its pricing and compensation system to curb any financial incentive a dealer might have to mark up interest rates for particular customers.

Toyota Motor Credit, as an indirect auto lender, sets interest rates, or “buy rates,” for consumers based on credit scores and other risk criteria.

While those rates are conveyed to dealers, Toyota Motor Credit allows the dealers to charge a higher interest rate when they finalize the deal with a customer — known as dealer markup.

According to the CFPB consent order [PDF], since 2011 Toyota Motor Credit permitted dealers to mark up consumers’ interest rates as much as 2.5%.

While an investigation by the CFPB and DOJ did not find that Toyota Motor Credit intentionally discriminated against customers, its policy to allow the markup of interest rates resulted in discriminatory outcomes.

In all, the investigation found that Toyota Motor Credit’s policies that permitted and incentivized markups resulted in non-white borrowers paying higher interest rates for their auto loans than non-Hispanic white borrowers without regard to creditworthiness.

Under this pricing and compensation structure, thousands of African-American borrowers were charged, on average, over $200 more for their auto loans. Additionally, thousands of Asian and Pacific Islander borrowers were charged, on average, over $100 more for their auto loans.

With its consent order, the DOJ and CFPB must pay $21.9 million in remediation to customers who received financing from Toyota Motor Credit between Jan. 2011 and Feb. 2, 2016. Nearly $2 million is earmarked for borrowers who will receive financing at some point between today and whenever Toyota implements its new pricing and compensation structure.

Toyota Motor Credit must also reduce dealer discretion to markup the interest rate to only 1.25% above the buy rate for auto loans with terms of 5 years or less, and 1% for auto loans with longer terms.