Walgreens Co. is liable for substantially contributing to the opioid epidemic in San Francisco as the city's largest dispenser of prescription opioids, a California federal judge ruled.