I do work the military and we routinely spend twice the amount needed for tools because we have to go through military suppliers.
You have to consider costs aside from production itself for meds. There is R&D, overhead like rent, staffing, insurance, trials, etc. That drug that costs pennies to make costs hundreds of millions to develop and those costs need to be recouped before the patent expires and the generic is produced.
Legos
Soda
Movie theater popcorn.