The answer to this can be found in Kant’s Grounding for the Metaphysics of Morals (this work’s title is translated in a number of other ways as well). It is found in the second formulation of Kant’s categorical imperative. In this formulation, Kant tells us that we must
Act in such a way that you treat humanity, whether in your own person or in the person of any other, never merely as a means to an end, but always at the same time as an end.
What this means is that we must never simply use people.
To treat a person as an “end” means to treat them as if they were important for their own sake. To treat a person as a “means to an end” is to treat them only as a tool. When we treat people in this way, we are essentially saying that they are only valuable as a tool that we can use to achieve something that we want.
For example, let us say that I tell my wife that I love her. If I tell her that because I care about her and want her to be happy, I am treating her as an end. I am thinking of what is good for her. Now imagine that I tell her I love her simply because I want to placate her so that she will be willing to let me spend the weekend hanging out with my friends. Now, I am no longer treating her as an end. I am using her feelings as a tool to gain my own happiness.
Kant says that treating people in this way is immoral.