I’ve had my passport checked a few times on trains by agents who board at one station and depart at another to switch back in the other direction.
I took a local train from Florence to Assisi in Italy.
We had to make a switch somewhere.
A local train cop got on at the stop and asked for ID.
I told him we had left our passports with the hotel in Florence. I showed him pictures of our passports on our phone.
He said that was not allowed.
My wife had her drivers license from NH. My son and I had no ID. Fortunately, we had an Italian friend with us who explained we were stupid American tourists and spoke Italian.
He proceeded to fine us in CASH. EUROS only. No credit card allowed.
My Italian friend said the guy gave us a break. I personally think he made an extra 120 EUROS that day. Live and learn.