Eight councillors were opposed to the ban - which would have seen all vehicles without a toilet, rubbish and wastewater facilities being directed to camping grounds.
Six voted in support of the ban, including Dunedin Mayor Dave Cull, who said the city was unable to cope with the current situation.
"Our community has quite clearly said to us, 'We don't think this is sustainable, we do not want this in our community' and here we all are second-guessing them and saying 'You don't know what's right for you, we know what's better for you, we know what's sustainable'," Mr Cull said.
"Our community has spoken and more than that I don't think the situation we have got is sustainable.
"We can maintain the status quo - where are they going to go? We haven't got the places. We haven't got the toilets. The next season is going to be mayhem."
Community consultation on the proposed ban showed the vast majority of the city's residents were supportive.
Of the 250 written submissions to the council, most supported the ban.
That move was supported by the council's staff and its bylaw subcommittee, who all said the move would bring Dunedin in line with other communities in the South Island and it was the direction much of the country was moving.
The ban would have come into effect almost immediately, with midnight tonight marking its beginning.
Council parks and recreation operations manager Jendi Paterson told the council staff were ready to roll out the changes, although an education-first approach would be taken for the first month followed by enforcement and infringement notices.
'We are playing a game of good tourist, bad tourist'
Councillors who opposed the ban said Dunedin should be seen as a more welcoming location to visitors than its prohibitive neighbours.
"My concern here is we are playing a game of good tourist, bad tourist," councillor Aaron Hawkins said.
"I feel like what we are doing here is saying we don't have the infrastructure here to cope with the exponential growth of the tourism industry, but rather than addressing the infrastructure problems we are using the size of a visitor's wallet as a proxy for who we should be welcoming here.
"I think that is something we should all be concerned about."
Mr Cull said council staff had attempted to find other locations for non-self-contained vehicles, which are limited to two reserves in seaside suburbs Ocean View and Warrington at present - but there were no other good alternatives.
"We are faced with an unsustainable situation if we don't do something to control non-self-contained vehicles," he implored councillors.
The bylaw subcommittee's chairman, Andrew Whiley, said councillors needed to remember they were not voting for an outright ban of freedom campers, but a move to direct vehicles without waste facilities towards camping grounds.
"The community have been pretty consistent right across the board in what they want," he said. "I don't know about you but I was elected by the residents."
The voting down of the proposed ban means the city would stay subject to the current bylaw that allowed non-self-contained freedom campers to spend one night parked in the reserves at Ocean View and Warrington.
Warrington resident Rhys Owen told RNZ this week that at the visitor season's peak about 150 vehicles had used the reserve last season.
Residents had put up with late night parties, destruction of their recreation facilities and faeces in the reserve, he said.
"We had 147 vehicles one night, so well over 300 people living in a domain right next to a residential area - that's a huge amount of people," he said.
He said the controls on freedom camping could not come into force soon enough for most Warrington residents.
This article was originally published by RNZ.