The Kroger Co. has agreed to pay up to $1.2 billion to resolve lawsuits brought by cities and counties over the opioid crisis.