As U.S. drug prices rise, drugmakers are playing down their role, instead heaping blame on the middlemen who help determine how medicines are priced.

Some of the sharpest criticism has come from drug-industry executives who have been grilled by lawmakers or skewered on social media over sharp price increases on their products. They include the chief of Mylan NV, maker of the lifesaving EpiPen, who says her company is being tarred unfairly for a dysfunctional system in which wholesalers, pharmacies and pharmacy-benefit managers...