By telling a parable, Nathan finds a way to have the king acknowledge his guilt.
David repents and God forgives him. However, there is a heavy punishment awaiting him for the rest of his life and even among his heirs.
Forgiveness and penalty: they let us understand that mercy and justice too need to go hand in hand. Sin is a terrible thing, even if we often try to do like the ostrich and hid our head in the sand.