A very good point! Even if the last stages (the RCTS) were paid for by the drug company, those studies were based upon literally dozens of experiments conducted by researchers funded by the taxpayers. Pharmaceutical companies are necessary entities for manufacturing drugs and getting them to market, since that's where their expertise and experience lies, but they often weren't funding much of the basic research that went into the early stages of development of the drug.