Any love that is contingent upon a specific factor is lost when that factor is gone (Ethics of the Fathers 5:19).
We may not be aware of some of our own faults, although we may easily detect them in others. We may observe a scene of a powerful dictator standing on a balcony, greeting the throngs who are shouting his praises and wildly waving banners bearing his likeness. Watching how the dictator basks in his glory and in the adoration of the populace, we wonder, "What kind of fool is he? Doesn't he realize that most of those people who are so enthusiastically cheering him actually despise him with a passion? They are there only because they fear his wrath, knowing that they forfeit their lives if they fail to acclaim him. Why, these very people will dance with exuberance in the streets when he is overthrown! How strange, that a person can delude himself to think that people who hate him actually love him!"
We know all this, yet in our own lives it is not unusual for us to "buy affection" in one way or another. Sometimes we do things for people in order to make them beholden to us, and when they then go through the motions that would indicate that they do indeed favor us, we interpret it as sincere affection or admiration, rather than what it really is - an affected attitude, beneath which there may be smoldering resentment, quite like that of the dictator's "admirers."
Certainly, we should do favors for friends, and we should extend ourselves to strangers as well, but we should not expect, nor even have a need to expect, that our action alone will earn us their love or respect.