Guilds generally aim for exclusive rights (or near it) over their craft/trade. This way nobody can practice such trade in selected area unless they pay the guild a fee. Magic does not change that much as we are talking about huge amount of small transactions involving money. You can influence some of them with magic but not all as that would be extremely taxing. If you want to influence guild leaders you should remember that they are rich and have magic protection of their own...
A guild may or may not have many wizards, priests, warriors, thieves, or magic items in its ranks.
But it does have gold. Likely lots of gold. To buy whatever services, items, informations, or loyalties are needed. At the very least, a guild can at least afford to hire some adventurers.
Maintaining a relationship with the local government and special provisions under the law would be a purpose to form an official guild.
For unofficial guilds, collective security and pooled resources would be useful in dealing with competing forces of opposition.
Being able to form contracts that are confirmed and enforced by the local government is a very useful thing, especially in matters where trust is needed to conduct business.