Opportunity cost is the value of the next-best alternative use of resources. When the government provides a commodity for free, the resources used to produce or acquire that commodity are not free from the perspective of society or the economy. Those resources (labor, materials, capital) could have been used to produce other goods or services. The cost of these foregone alternatives is the opportunity cost. Since the consumer doesn't pay for the commodity, the burden of this opportunity cost (funding the production/acquisition) is shifted to the general public, primarily through taxes. Taxpayers pay for the resources used by the government, effectively bearing the opportunity cost that consumers would have borne through direct payment.