Alameda County Superior Court Judge Wynne S. Carvill has ordered Pleasanton-based Safeway Inc. to pay $9.87 million as part of a settlement of a civil environmental prosecution. Alameda County District Attorney Nancy E. O'Malley said 42 other California district attorneys and two city attorneys were involved with her office in the investigation of the unlawfully handling and disposal of various hazardous wastes and materials over a 7-1/2-year period by Safeway and Safeway-owned stores.