You don't see the state doing the basic research of mobile phones and then giving it away to Samsung or apple.The state (mainly the military) did basic research in signal processing and electromagnetism. Apple and Samsung turned that basic research into consumer devices you can buy at the store.
They give their money away with tax money and get zero back in return?
If private entities didn't turn molecular entities into drugs, then yes, the public would get nothing for their money.
The fact is you can't buy arbitrary chemicals in the pharmacy, and very likely you believe it should be illegal to do so (do you favor abolishing the FDA and all drug regulation?). Pfizer needs to turn drug ideas (what the NIH generates) into actual drugs, just as Samsung needs to turn coding schemes and relativistic corrections into actual consumer devices.