Gents:
I rather think the photograph you have seen of a rail mounted gun, was the "Dictator" which was a large mortar, though not of the Coehorn design, and mounted on a flatbed railroad wagon, the gun weighed about 17,000lb. and a typical shell weighed in at about 770lbs
The gun crew together with the mortar, ammunition etc, was towed by train to a level location close to the battle and fired when needed, the engine was left attached in case of counter fire.
The photograph I have was taken during the battle for Petersburg.