They aren’t wholly theorized and funded by the government.
By far the most expensive step of drug development is the phase 3 clinical trial, the final stage before a drug can be released. The government doesn’t fund those at all. Government mostly funds pre-clinical trials (ie in animals or tissue culture) which are way cheaper.
The average government grant for a biomed research proposal is nearly $600,000.
The average phase 3 clinical trial costs $20 million.