verb: gain favor with somebody by deliberate efforts
Even though Tom didn't like his new boss, he decided to ingratiate himself to her in order to advance his career.
I find the meaning a little vague even after searching multiple sources.
My doubt is that we gain favor from someone not with someone by putting efforts. We do favor for someone not with someone.
What is the clear meaning of this word is still unclear to me?