If you want to "self tour" as we did get off the ship early and head to the Tourist Info center and purchase a BerganCard. Big savings on museums and transportation and you will be ahead of the other tour groups.
If you want to travel on the Flam railway there are two options -- buy a tour or self tour. If there are more than two cruise ships in port at the same time the railway will probably sell out and be available only to prepaid tour groups. However, if you get off your ship immediately and race to the railway station you might make the first train ahead of the tour groups. There is a small tram which tours the valley floor (for a fee) and takes you to the village of Flam located about 2.5 miles from the port area or, if the weather is nice you can walk it. We walked it as it was a beautiful day and the terrain was level. Flam has tourist shopping located at the port area and there are no services in the village area -- all shopping, including the grocery store, is located right at the dock area.