There was a line in The Netherlands where the 'pay driver on entry' system operated, north of Zuider Zee, if I remember correctly. I think there was an article in Modern Railways but it was a many years ago.
On a single unit railcar e.g. similar to the preserved GW railcars or a single car pacer

, I can see it working in theory and practice, but, if you are carrying that few passengers throughout the route, every service, every day, why bother running the train at all!
As has been said, and like the removal of conductors from buses, it will save money on crew costs but slow journey times considerably, thus making the service less attractive and reducing usage further. If people were quick to board, knowing their fare and having the correct money ready, that would help speed things up, it doesn't happen like that with buses so I can't see it happening on trains.