The diesel fuel that the train company will buy has already been taxed at the refinery (if it's a diesel train). The gas that the power company will burn to generate power for an electric train has been taxed at import. The train company will simply pay the price of these goods, tax included, and pass this cost on to the owners of the goods being shipped. How is up to them.
Likewise, the "hidden" emissions from the production of the train are likewise "hidden" in its price: The steel that the train was made from was already taxed when it left the steel mill (not 100% familiar with steelmaking, but this may be one of the cases where it's insufficient to just tax the inputs since the steel mill might emit GHG that don't just come from fuel). The cost of the energy used in processing that steel already contained the cost of the emissions tax that was initially levied on the fuel. etc.
Firstly, what kind of excuse is this - imagine the same argument applied to social networks, should they just leave child porn on their websites because it too difficult to keep track of? What if a social network has billions of photos? Business has to follow the law, just like I do.
Secondly, we have armies of people collecting data on these containers and doing data science to manage and optimise supply chains, and they have the containers, their weights and contents documented for customs, to make sure they are safe and not overloaded, for insurance purposes, so they can be delivered to the right customer, many containers are independently GPS tagged, etc.
All this data already exists for every major carrier, haulage, etc. The hard part is like one guy delivering donuts part-time, but we don't need to go after that.
What if it's a giant shipping boat with thousands of containers?