Federal prosecutors have opened a criminal investigation into whether pharmaceutical companies intentionally allowed opioid painkillers to flood communities, employing laws normally used to go after drug dealers, according to people familiar with the matter.