Its ownership passed through a series of government departments before ultimately coming under the control of New Zealand Railways.
This passage describes how ownership of something changed hands over time, eventually being transferred to New Zealand Railways.