Memorial Health Services, a Fountain Valley-based nonprofit health care organization, has agreed to pay more than $31.5 million to resolve allegations that it overbilled Medicaid for prescription medication purchased and reimbursed under a federal drug pricing program, the U.S. Department of Justice announced Monday.