Two retail pharmacy giants have been sued in separate class action lawsuits for their alleged role in soaring prescription drug prices—an indication that plaintiffs lawyers may be assuming a role traditionally left to legislators.

In complaints filed on Monday and Wednesday, consumers accused CVS Health of Woonsocket, Rhode Island, and Walgreens Boots Alliance Inc. of Deerfield, Illinois, respectively, of colluding with pharmacy benefit managers to sell certain generic drugs at a higher cost if they are purchased with insurance.