Massachusetts and other states reach $4 billion settlement w