The moral of “The Legend of the Moor's Legacy” is a fairly simple one: greed does not pay. In fact, not only does it not pay, it can lead to some pretty unpleasant consequences. The avaricious Alcalde, the local mayor, along with a constable and a nosey barber, learn this lesson to their cost when they're buried alive in a vault filled with treasure beneath the Tower of the Seven Floors. They were driven to explore the vault by nothing more than pure, unadulterated greed. And now they've received their just desserts.
Unlike the story's protagonist Peregil, they had done nothing whatsoever to deserve any of the phenomenal riches that had lain hidden for so many years. Peregil ends up sharing the treasure with a Moorish shopkeeper not because he's greedy, but because he kindly helped out a stranger when he was sick and in need of somewhere to rest his weary head. His share of the treasure is his reward for extending the hand of friendship to a stranger in need, a stranger from a different ethnic and religious background.
In that sense, one could say that the story provides us with another important moral lesson: that we are all part of the same human race and that there is more in common between us than what divides us.