R. Shimon b. Yochai says: An analogy: A king had many sons and servants, who were fed and sustained by him, the key to the storehouse being in his hand. When they do his will, he opens the storehouse and they eat and are sated. When they do not do his will, he locks the storehouse and they die of hunger. Thus with Israel. When they do the L-rd's will — (Devarim 18:12) "The L-rd will open for you His goodly treasure trove, the heavens," and when they do not do His will — (Ibid. 11:17) "And the wrath of the L-rd will burn against you, and He will hold back the heavens and there will not be rain."
The King Who Locks the Storehouse When Disobeyed
Sifrei Devarim 40:12