It was a different time. Often they had their own land, or people gave them food etc. for their teachings. Also many times they were mentors to wealthy families that basically took them in and cared for them [like Maecenas in Rome], essentially becoming their patrons.