It seems to me that the moral of the story can be summed up with Portia's famous speech to the court and to Shylock:
The quality of mercy is not strained.
It droppeth as the gentle rain from heaven
Upon the place beneath. It is twice blest:
It blesseth him that gives and him that takes.
'Tis mightiest in the mightiest; it becomes
The throned monarch better than his crown.
His scepter shows the force of temporal power,
The attribute to awe and majesty,
Wherein doth sit the dread and fear of kings.
But mercy is above this sceptered sway;
It is enthroned in the hearts of kings;
It is an attribute of God himself;
And earthly power doth then show like God's
When mercy seasons justice. (4.1)
This is what Portia was trying to get across to Shylock as he waited for his pound of flesh from Antonio. I believe, though, that it was a lesson that all SHOULD have learned, although I realize that not all did learn it (Gratiano comes to mind as someone who really needed to learn about mercy).