The $3.97 is the average for highway grade price, so it would include the tax.
If I read Chapter 1 Fuel Taxes Page 7 of the following correctly, that tax applies to trains as well.
Publication 510, Excise Taxes
That only address the federal 24.4¢/gal tax. The state rules may differ for their fuel excise tax.
Odd. One would think that diesel fuel for locomotives would be treated like farm diesel. I wonder what the justification is. Or if they even bothered to come up with one...