Almost every time I start one of these stories, I feel like saying to the reader, this is hard, I expect you to appreciate it!
The first person in history I know of who said this was Cain talking to God. God didn't appreciate Cain's efforts, which were agricultural, compared to those of his brother Abel, a shepherd to his flock. God says to a very upset Cain: do right, and you will get my attention. Don't do right, and you'll make a serious mistake and get yourself into trouble.
Cain and Abel is a very short story, like others in Genesis, and every word and incident counts. God sets rules, but the reward and punishment are our staying in the game or being thrown out. You can live happy in the Garden of Eden if you don't want to know the wrong things, eat the fruit from the tree of knowledge, but if you break the rules, you're out. Obey the rules, you have life: you can eat the fruit from the tree of life, that's not forbidden. Don't talk to me about rewards and punishments, God says, don't discuss it. There is only one bargain with me you can be sure of, and that is, expect something from me more than paradise, or losing that, the temporary paradise of my love, and you won't get it.
Cain is downcast. He doesn't understand. He expects God to respond to his efforts, and because he expects it God doesn't.
So Cain, son of fallible man and woman, makes the mistake. If following the rules doesn't work, why follow them? Why be his brother's keeper, if that is not his job? His job pays for itself with produce, whereas God doesn't pay. He sends a message to God: I'm on strike, I'll break your machine. Henceforth, I'll obey the rules that pay in this world, and in this world I am not a shepherd and not a shepherd to my brother. Who needs him?
God gets the message and responds perfectly, as of course God should. He takes away Cain's job, or rather makes sure it will not pay, and makes Cain a wanderer always distant from his presence. Cain complains that anyone can kill him now. And God again responds perfectly, making a rule of the kind Cain wanted: anyone who takes revenge on Cain will be avenged 7 times more.
Cain's punishment is to be kept alive with a rule made to order just for him, but to be permanently removed from what rule following was for, to return to God's love. Cain is punished with never being able to profit by rules.
This took a lot more words than Genesis used to say the same thing, but this is Christmas day and it seemed a good way to explain what I wanted for Christmas.