Prior to the episode BtVS: Consequences, Faith was (for all intents and purposes) still well under the control of the Watcher's Council. She and Buffy were entirely unaware that the Mayor was evil and he'd certainly made no direct overtures to recruit her. He was definitely aware of her existence though, having paid people to try to kill her and Buffy in BtVS: Bad Girls.
Faith inadvertantly killed the Deputy Mayor and her world crashed down around her. She seems to have suffered a mental breakage, compounded by the loss of her friendship with Buffy and the realisation that the consequences of her actions would almost certainly mean her being de-powered (an idea that she really dislikes given her childhood) and held by the Watcher's Council indefinitely. As we can see from the shooting script, realising that the Mayor offered protection, she burned her bridges with Buffy, Giles and Scoobies and approached him directly.
[Buffy and Faith walk quickly. Buffy is reeling, freaked by what she just saw. Faith, on the other hand, seems pumped.]
FAITH: So the mayor of Sunnydale is a black hat. Shocker, huh?
and
BUFFY: ...And Faith just acts like she doesn't care. The way she talks, she doesn't even think she made a mistake.
[Willow takes it all in. Overwhelmed].
WILLOW: You think she's like, in shock?
and
WESLEY (O.C.): I am exercising my authority and removing you to England, where you will accept the judgement of the disciplinary
committee.
[As her EYES GO COMPLETELY DEAD. This is the last straw.]
and
FAITH: Guess that means you have a job opening.
[And she smiles. A beat as the Mayor gets her drift. Then he smiles...
Steps out of the doorway, inviting her in.]
Note the stage direction. He really wasn't expecting this.