Where on the train would you have place to perform this exactly?
Customs declarations are usually made at the entry-point (at least with international air travel) - but I don't know how trains do that today (all my train travel was Schengen zone in the late 90s - just passport checks on the train, and only between some countries).