Retailers including Albertsons and Kroger are dealing with billions of dollars in costs stemming from their roles in dispensing addictive medications.