Section 55. A purchaser of a railroad at a sale under a valid foreclosure of a legal mortgage thereof, and his successors in title, shall, relative to the construction, maintenance and operation of said railroad, be subject to all the duties, liabilities and restrictions, and have all the powers and rights, which the mortgagor was subject to and had at the time of said sale.