TH White, The Once and Future King:
"'Sometimes,' he said, 'life does seem to be unfair. Do you know the story of Elijah and the Rabbi Jachanan?'
'No,' said the Wart.
He sat down resignedly upon the most comfortable part of the floor, perceiving that he was in for something like the parable of the looking-glass.
'This rabbi,' said Merlyn, 'went on a journey with the prophet Elijah. They walked all day, and at nightfall they came to the humble cottage of a poor man, whose only treasure was a cow. The poor man ran out of his cottage, and his wife ran too, to welcome the strangers for the night and to offer them all the simple hospitality which they were able to give in straitened circumstances. Elijah and the Rabbi were entertained with plenty of the cow's milk, sustained by home-made bread and butter, and they were put to sleep in the best bed while their kindly hosts lay down before the kitchen fire. But in the morning the poor man's cow was dead.'
'Go on.'
They walked all the next day, and came that evening to the house of a very wealthy merchant, whose hospitality they craved. The merchant was cold and proud and rich, and all that he could do for the prophet and his companion was to lodge them in a cowshed and feed them on bread and water. In the morning, however, Elijah thanked him very much for what he had done, and sent for a mason to repair one of his walls, which happened to be falling down, as a return for his kindness.
The Rabbi Jachanan, unable to keep silence any longer, begged the holy man to explain the meaning of his dealings with human beings.
'In regard to the poor man who received us so hospitably,' replied the prophet, 'it was decreed that his wife was to die that night, but in reward for his goodness God took the cow instead of the wife. I repaired the wall of the rich miser because a chest of gold was concealed near the place, and if the miser had repaired the wall himself he would have discovered the treasure. Say not therefore to the Lord: What does thou? But say in they heart: Must not the Lord of all the earth do right?'"
On the other hand, an all-knowing and all-powerful God could just as easily have decreed that the treasure be buried where the cow stood while drinking at it's trough so that the cow uncovered the chest for the poor man to find. No need for the cow or wife to die, or for the miser's wall to be rebuilt.
--- Penguin