How did the wizards earn their living?

I am not sure if I missed it or it was never mentioned in the books or the movies, but how did the wizards "pay" for their food and other stuff?

Is it like a barter system or something of the sorts going on there?