I'm not answering the exact question, but the train check between Switzerland and the near EU countries (all in Schengen), which should be similar.
Also before Switzerland entered in Schengen Area, the check were random. You may see custom agents (or immigration agents, or both) on many trains, but still then, they checked only few people, and not on all trains (and for sure not on all road/paths you can traverse the boundary).
Schengen is about people, not goods, so from time to time there is control of goods (which are performed more often compared to control of people). Maybe just few people on one wagon in the station, or maybe during the travel between stations.
If you have goods which should be declared or you need a stamp you should get off the train in the correct station (often the first station in the country, but it can be the last station of the previous country). Note: there is no scheduled check in timetable, so you should plan to catch a later train to continue the travel. It is annoying if you need a stamp for duty free items. Note: on train there will be an announcement similar to "You are allowed to cross the boundary only if you have no goods to declare, ..."
As usual: for large amounts of goods, you must cross the border on commercial customs, on their opening time.
Note: also on major lines, now the custom offices may be closed most of the time, but there are forms+letter box (or an app) to declare goods. If there is a check, they will check you declared correctly. The negative part: you are on your own: you cannot ask questions.