The theme of this story is that greed and selfishness cause unhappiness while kindness and selflessness bring rewards. This is a statement of what makes (in the author’s mind) a good character.
In the story, the man is amply rewarded because of his good character. He is kind to the sparrow and clearly cares about him. He cares enough to wander around, trying to find the sparrow (undergoing hardships to do so in some versions of the story). He is humble and selfless enough to meet the sparrow’s family, eat with them, and then pick the smaller treasure.
By contrast, the woman is punished for her greed and selfishness. She is pushy and greedy, going so far as to insist on being given a gift (where the man simply hung out with the sparrows and was spontaneously offered the gift). For this, she is punished.
This clearly shows that the theme of the story is that a good character, in the shape of kindness and selflessness, gets rewarded.