8 “Whosoever is not righteous is not of God, neither he that loves not his brother.” “For this is the message:” mark how he confirms it: “For this is the message which we heard from the beginning, that we should love one another.” He has made it manifest to us that it is of this he speaks; whoso acts against this commandment, is in that accursed sin, into which those fall who are not born of God. “Not as Cain, who was of that wicked one, and slew his brother. And wherefore slew he him?
Because his own works were evil, and his brother's righteous.” Therefore, where envy is, brotherly love cannot be. Mark, my beloved. He that envies, loves not. The sin of the devil is in that man; because the devil through envy cast man down. For he fell, and envied him that stood. He did not wish to cast man down that he himself might stand, but only that he might not fall alone. Hold fast in your mind from this that he has subjoined, that envy cannot exist in charity. You have it openly, when charity was praised, “Charity envies not.” There was no charity in Cain; and had there been no charity in Abel, God would not have accepted his sacrifice.
For when they had both offered, the one of the fruits of the earth, the other of the offspring of the flock; what think ye, brethren, that God slighted the fruits of the earth, and loved the offspring of the flock? God had not regard to the hands, but saw in the heart: and whom He saw offer with charity, to his sacrifice He had respect; whom He saw offer with envy, from his sacrifice He turned away His eyes. By the good works, then, of Abel, he means only charity: by the evil works of Cain he means only his hatred of his brother.
It was not enough that he hated his brother and envied his good works; because he would not imitate, he would kill. And hence it appeared that he was a child of the devil, and hence also that the other was God's righteous one. Hence then are men discerned, my brethren. Let no man mark the tongue, but the deeds and the heart. If any do not good for his brethren, he shows what he has in him. By temptations are men proved.
Source: Homilies on the First Epistle of John (New Advent)