The companies were very aware that opioids were being trafficked. For example, in Kermit, Kentucky (pop 392), drug companies shipped 9 million opioid doses over 2 years [1]. You don't have to be particularly analytical to figure out they were being resold into the black market with that order of sales numbers.
[1] http://www.wvgazettemail.com/news-health/20161217/drug-firms...