Thanks to Amazon Kindle's tons of free books that are available, I've been reading Martin Luther's Commentary on Genesis, which has been fairly fascinating.
In the story of Cain and Abel, Luther addressed a question that I have had for a long time. "If Cain was sentenced to roam, then why is it that he founded the first city?"
Luther compared Adam's being cast out of the Garden to when Cain was cast out. When Adam and Eve were cast out of the Garden, they had the promise of the Messiah and the promise of God's protection. Cain was not given that. He was not given a direction to go. He could go east, west, north, south. He could work hard to prosper, and have no promise that it would benefit him. He was cast away from his family, never to see them again, and no promise about his progeny and what would become of them.
So while Cain founded the first city, there was no promise that it would prosper and continue to prosper. There was no promise that his children would survive, and in fact, every descendant he had was destroyed in The Flood. Cain did not have God's blessing on what would come.
There were two things that God promised, though. If someone killed Cain, he would be severely punished, and that Cain would have a wife. Luther states that this was done for two reasons. It was an act of mercy that gave time for Cain to repent. It was also an act of "uncovenanted mercy" for the sake of the elect, so that those who were his descendents who were elect could be saved. Cain was meant to have children who would come to faith. After all, Seth's descendants would come into contact and even marry some of the descendants of Cain's, and hear the Word of God proclaimed.
There are two kinds of promises, Luther explains. The first, legal promises, depend on our own works. When God tells the Children of Israel that they will prosper as long as they keep His commandments, that is a legal promise. This also explains why God seems so "temperamental" and can change His mind when prophets beg God to stay his judgement and not destroy the people whenever He threatens to. God has every right to destroy the Israelites when they depart from His will at any time He wants, but He also can hold back and wait to see if they continue to rebel against His will.
The question "If thou doest well, shall not thy countenance be lifted up?" in Genesis 4:7, that is said to Cain is also of this type. And Luther points out that moral nations do tend to prosper and have better order than immoral nations. As Lutherans, we don't like to say "God sent this hurricane because of our wickedness" and in a sinful world, that is correct, we really cant judge whether or not an individual act is a punishment for wickedness. But on the whole, a nation that behaves well, prospers. Empires that fall into wickedness tend to decline.
But there is another type of promise, the promise of grace. These have no threats of what will happen if our end is not kept. "I will put enmity between thee and the woman," "I will write the law in their inward parts, in their heart will I write it: and I will be their God, and they shall be my people." are examples of promises of grace. Because He made these promises that were in no way dependent upon our works, He will keep them under any and all circumstances.
Adam had promises of grace. Cain also should've had that promise, a life that was guided by God that would also lead to the eventual birth of the Savior of mankind. But Cain killed his brother and refused to repent, refused to come to God for mercy. So Cain's direction would not be guided by God or blessed by God. That is what made Cain a vagabond and a wanderer.