The infirmary or the pesthouse of a city may be located either inside or outside of the city limits, and the legislative authority may purchase and hold the necessary real estate on which to build it.