I found a site that said the ticket would cost around $50. Then when I went to to book it on a site it told me to use, rail.ninja, the price was closer to $175. Is there an official rail site to book on?
Vy.no is the site you want. You would book as one ticket from Bergen to Myrdal and Myrdal to Flåm.
Alternatively, you could book the train from Bergen to Voss and take the scenic bus to Gudvangen and then the ferry from Gudvangen to Flåm through the spectacular Naerøyfjord and the Aurlandfjord. The express bus and ferry can be booked with [Norways Best].2
Do not book through rail.ninja!
But $50 is too low- an impossible fare. The Myrdal to Flam section alone is around 600Kr= £60/$78 US
Looking at almost the limits of current availability- 5 October- the price varies a bit around 877 to 897 Kr- say 900 Kr= about £90 x 1.3= $125 US. That is your baseline lowest possible fare.
Bergen to Oslo direct you might get for about 500Kr- $68 US
Rail.ninja is a scam site. Do not use that. Do not even think of using that site.
They pay google to end up high in search rankings. but they are not an official railway ticket agent. All they do is take your money, then go on the official site and do there what you could do yourself. But they often double the price in the process...
When we were in Bergen we just booked package that involved a (very nice) ferry ride to Flam, the train to Myrdal, and the train back to Bergen. We just booked that locally. I do not think you need to book that in advance.
Thank you all!