"... if there was no law given against sin men would not be afraid to sin. And if there was no law given, if men sinned what could justice do, or mercy either, for they would have no claim upon the creature?
But there is a law given, and a punishment affixed, and a repentance granted; which repentance, mercy claimeth; otherwise, justice claimeth the creature and executeth the law, and the law inflicteth the punishment; if not so, the works of justice would be destroyed, and God would cease to be God." Alma 42:20-22
It's very true that God has given us laws that have set punishments affixed for disobedience. What's interesting is that we often don't know what the particular punishment is until we stop disobeying and start following the law. The punishment could be as simple as the withholding of blessings or as serious as losing the companionship of the Holy Ghost. They could be additional trials and roadblocks in our life or painful situations meant to encourage us to turn back to the source of peace and joy.
Some may seem to escape justice and punishment on the earth, but it is an illusion. They will be subject to the full effects of justice without the mitigating touch of mercy. Often those who seem to be profiting from their disobedience here on earth are feeling the affects of their disobedience but choose to chalk it up to outside influences or circumstances. How often does sin lead to depression, discontent, heartache?
The good news is that God granted us the gift of repentance so that we can be shown mercy. This usually means that the length or severity of our punishment is diminished throught Christ's atonement. We still suffer some of the punishment, but it's Christ who bears the brunt of it. It's like getting a few minutes taken off of a time-out or fewer smacks of a spanking. The punishment is affixed and has to be given in full, but Jesus steps up and takes the additional for us.
I think of my dealings with my own daughter. When she is disobedient it often angers me. But at the first sign of real remorse and desire to obey my heart is softened and I want to be more lenient with the punishment. She ends up benefiting from my feelings of mercy and love.
I think Heavenly Father feels much the same way towards us. When we are disobedient it makes Him mad. Sometimes He'll send some pretty severe punishments our way. But at the first sign of real repentance He lets Christ step in and offer to take a portion of our punishment. I can't imagine what it would be like if I had to pay the full price of every sin I've ever committed. I thank God that Jesus made it possible for mercy to have it's claim upon me.