This has a lot to do with the oligopoly in pharmacy benefit managers. top 3 PBMs account for 79% of all prescriptions dispensed in 2020.
These companies in turn negotiate hard with generic manufacturers that often they sell at a loss and aren't motivated to produce for America.