Bank of America has agreed to pay $335 million to settle allegations that Countrywide Financial, a mortgage giant that the bank now owns, discriminated against African-American and Hispanic home buyers during the housing boom. The Justice Department had alleged that Countrywide charged higher fees and rates to minority buyers than to white applicants with equal incomes and credit scores. Bank of America spokesman Dan Frahm stressed that the lending bias occurred before the bank bought Countrywide. “We are committed to fair and equal treatment of all our customers,” he said in a statement. An independent monitor will be appointed to contact potential Countrywide victims and distribute the $335 million proceeds among them.