Ruling favors cities that have been looking for ways to legally restrict the number of properties that can be used for short-term rentals.