Any city of the first class in the state, or any such city and the county in which it is located, acting jointly, are hereby authorized to buy from the federal government, upon such terms as may be agreed upon between the proper officials of the city or of the city and the county acting together, and the federal government, by written contract, any property owned by the federal government which is needed for a civic center or public park purposes, in the municipality.