You were lucky.
I would have mentioned ICE trains but they operate infrequently every one or two hours depending on the time of day. The ICE takes 11 mins according to bahn.com
Bahn.com shows a one-way on the ICE of Euros 8. Not sure how much the S-Bahn costs (S-Bahn fares should be cheaper) but even Euros 8 is much cheaper than a taxi.