There are various subcategories and as with 'foamer' one sort of needs the context to know whether it's a putdown or an affectionate bit of humor (or humour in Canada and the UK).
My father was (and at 98 is) a
juice fan. When his club was founded in the 1940's there were hundreds of miles of Class I, II and interurban electric railways in the Pacific Northwest and there were serious attempts at electrifying "steam" railways.
Railway enthusiast is a term I've seen used in news media that didn't permit sneers about people who like trains (as compared to real men who like autos, planes, boats).
My favorite that makes a joke about even trying to label was
ferroquinologist. I hope I spelled that right.
The Germans have
eisenbahnfreund in common usage. As usual, the French sounds better:
ami du rail.
I might be wrong but have the impression that European railways are more likely than here to be willing to hire young railfans.
And though I learned to say "the train is always late" in high school Russian, they must have a term for railfans. Out in Siberia in 2010, my train rolled out of the generic forest around a curve into a clearing and there was a 16-year-old or so kid with a camera. He must have hiked a fair way from his village to get that perfect shot of the sleeping car train, the
Tomych. Someday we'll read a
Trains magazine article on "trains of Siberia" and we'll see his photo credit.
The young guys in the first 1971 photo tipped me off to where employee timetables were disposed of and knew some good spots for photos. The second photo shows the tour group I was permitted to join up with on the Hamburg U-Bahn -- they spoke German at exactly my level!