The taxes still paid for it twice
Socialized risk and privatized profits. A capitalist's dream.
To go back to your highway analogy, its as if the government contracted for the entire interstate highway system to be built and then let various private companies charge a perpetual toll to use the roads in addition to the money they made for building it.
Its not an accounting trick, its a perpetual royalty on the taxpayer's expense if the drug works (and a profit even if their drug never passes Phase 3 clinical trials).