Carriers (UPS, FedEx, and the various freight companies) charge shippers a fee for each hazmat shipment the shipper sends out. The government does not receive any portion of the hazmat fee and does not set the hazmat fee. The carriers charge a fee to offset the increased costs involved in dealing with the hazmats including paperwork verification, special handling, load restrictions, and employee certifications. The shipper may add on an additional amount to the fee imposed by the carrier. This fee will help cover the additional costs associated with the mandatory training, and certification of the shipper's employees, as well as the additional cost of shipping supplies.
The government is only involved in classifying an item as hazmat and enforcing compliance with the regulations. They don't make any money off of it.