"it would be more efficient for the government to simply pay for tests directly"
If the government did that, then pharmaceutical companies could outsource all high-throughput experiments to the government.
The government does not do the tests themselves, because they are expensive and the outcome is unsure. Private investors are more motivated to minimize the costs for testing. The government needs to specify the requirements that the drugs should meet.