So it came about in the course of time that Cain brought an offering to the LORD of the fruit of the ground. And Abel, on his part also brought of the firstlings of his flock and of their fat portions. And the LORD had regard for Abel and for his offering; but for Cain and for his offering He had no regard. So Cain became very angry and his countenance fell. (Genesis 4:3-5 NAS)
And Isaac prayed to the LORD on behalf of his wife, because she was barren; and the LORD answered him and Rebekah his wife conceived. But the children struggled together within her, and she said, "If it is so, why then am I this way?" So she went to inquire of the LORD. And the LORD said to her, "Two nations are in your womb; And two peoples shall be separated from your body; And one people shall be stronger than the other; And the older shall serve the younger." (Genesis 25:21-23 NAS)
The Oxford Dictionary defines favoritism as unfair favoring of one person at the expense of another. As parents, we sometimes favor one child over another. As workplace supervisors, we may favor certain subordinates while neglecting others, and as teachers, we may prefer some students to others. Whether it is favoritism towards siblings or to workplace subordinates or students, there will always be unfair treatment because of favoritism.
We reward people who obey and punish those who rebel, and there is nothing wrong with that. But if we do it because of pure preference, even when we know the other deserves it more, then we are doing wrong, just as Isaac was wrong when he planned to bless Esau instead of Jacob (Genesis 27), even when he knows before hand whom God has chosen (Genesis 25:21-23). This is clearly favoritism (Genesis 25:28 NAS).
The story of Cain and Abel may seem to show God's preference for Abel to Cain, but it is not a demonstration of favoritism because God's ways and man's ways are never the same. For God can read the heart of man and He knows Cain's attitudes and intent. The Bible states:
Then the LORD said to Cain, "Why are you angry? And why has your countenance fallen? "For if you do well, will not your countenance be lifted up? And if you do not do well, sin is crouching at the door; and its desire is for you; but you must master it." (Genesis 4:6-7 NAS)
Cain did not do well, so his offering God has no regard. It is all a matter of the heart. For God is not a man that He should show favoritism, nor a Person Who is unjust or unfair to show preference. For it is clear what Genesis 4:3-5 says, that while Cain offers up the fruit of the ground, it was only Abel who offers the firstlings and the best portion. Abel gives of his best to God, but Cain did not (Hebrews 11:4). It is for this reason that Cain's offering was not regarded by God.