I am pretty sure $40 isn’t the cost of the exams. It is being subsidised by other tax payers. We can discuss the merits of this approach but it is not necessarily cheaper overall.
The US government pays more for healthcare in the US than many other countries. When you add in private insurance the US far outspends outher countries for healthcare. But they don't have better results. For example, the US has a shorter average lifespan than many countries.