As I discuss in this answer, the Kedara Kanda of the Skanda Purana describes Mahabali's previous birth as a gambler who was a sinner all his life. Before he dies, the gambler accidentally makes an offering of betel leaves, flowers, and sandal paste to Shiva. As a result, in the afterlife Yama the god of death gives him an hour and twelve minutes to rule Devaloka. The gambler spends his short reign as Indra giving away all of Indra's possessions, including the wish-giving Kalpavriksha tree and the flying horse Ucchaishravas (which I discuss [here]), to various Rishis.
When the actual Indra regains his throne, he finds that all his possessions are gone, and when he finds out what has happened he complains to Yama. Yama chastises the gambler, saying that charitable giving is only allowed on Earth, not in Devaloka:
Charitable gift is commended on the earth where the fruit of Karman is had. In heaven charitable gift should never be given to anyone at any place. Hence, O stupid one, you are worthy of being punished. What is opposed to the injunctions of the scriptures has been perpetrated by you.
Yama is just about to punish him, when Chitragupta points out that charitable giving is allowed even in Devaloka when it is done out of devotion to Shiva:
Everything that is given away with Shiva in view either in heaven or in the world of mortal men is, it should be known, everlasting. It is called a flawless Karman. Hence there is no question of this gambler falling into hell.
So the gambler is freed from the sins he had committed in life, and he is reborn as Virochana's son Mahabali, although his father Virochana dies before he's born for reasons that I discuss in this answer. But my question is not about the gambler himself, but rather about what Yama says to him.
My question is, why does Yama say that the gambler's actions are "opposed to the injunctions of the scriptures"? Are there any statements in Hindu scripture that charitable giving is not allowed in Devaloka? I'm not familiar with any scriptures that give particular rules for inhabitants of Devaloka.
Or is the point of this story that Yama is misinformed on this issue? Chitragupta says that charitable giving "with Shiva in view" is allowed in Devaloka. But what about someone who engages in charitable giving for other purposes, like if he's just feeling generous?