There are a number of responses:
The 10 Commandment tell you not to covet your neighbor's wife nor to covet your neighbors things. You would of course not covet those things if you were not comparing your lot with theirs.
Envy comes about when you compare your lot to another's and feel like you are coming up short. You think your suffering will be assuaged if you bring the person down to your level.
Lust comes about when you are sexually attracted to someone you should not be sexually attracted to. You are comparing yourself with and without that person. Comparing yourself with your future self can also create suffering.
Pride comes about when you compare your lot to another's and feel pleasure that you are better off than them.
Greed comes about when you compare your lot to another's and feel like you are coming up short. You think your suffering will be assuaged if you bring yourself up to that person's level.
Each of these sins, then, comes about from comparing yourself to others.
None of these sins could take place if people did not want to mimic others. Humans are natural mimics. The overwhelming majority of things you do are simply because you mimic everyone else around you. But what happens if you find you cannot mimic everyone else? Envy, lust, pride, or greed, depending on your own situation and your own feelings.
One could also include a kind of shame, which would be the flip side of pride, where you feel ashamed that you are better off. Due to greed, we don't want to give up our own wealth, so we promulgate envy to try to shame others into giving up their wealth, or to get others (government) to simply take others' money to try to ensure everyone is the same--sameness, egalitarianism, is an extreme version of the kind of mimesis about which I am speaking.
All of these things are sources of suffering.
We need to avoid comparing ourselves to everyone else. We need to accept that our learning is overwhelmingly mimetic in nature, but that does not mean we have to compare ourselves to others. We can accept without envy, accept without greed, accept without lust, and accept without pride. And we can give without invoking any of these things, either.
We should fill our cups to overflowing, and pour ourselves out to the benefit of all, but without ego to the extent we can do so. Our actions will then be beautiful. Our actions will then be creative. This is what happens when a person is creative. They are in the flow state, which is always without ego, which is always focused on the task. The flow state is always a happy state.
When you compare yourself to others, you are sinning. You are destroying yourself and you are seeking to destroy others. Sin is always destructive, and destruction is the opposite of creation, wealth, virtue, truth, and beauty.