''You will not come to the Land...'' [Shelach 14:30]
G-d does not issue a punishment to bring revenge on the sinner. Rather, the ''punishment'' is a form of spiritual ''medicine'' aimed at correcting the spiritual deficiency caused by a sin.
With this in mind, the ''punishment'' given to the Jewish people here is difficult to understand. Their sin was that they did not wish to enter the Land because they desired to remain in the desert where they could serve G-d without distraction; and yet, their punishment was to receive what they wanted: to remain the desert [for forty years!] How would this ''correct' their sin of not wanting to enter the Land?
In truth however, the sin of the spies was not that they were too spiritual, but rather they were not spiritual enough. To be involved with the physical world and remain spiritually attuned demands the highest degree of attachment to G-d. So when the generation showed that they were lacking this level of dedication, they were given 40 more years of unrestricted Divine worship, enabling them to reach the level where they would be ready to engage in the world.
Source: Based on Likutei Sichos Vol 33 Lubavitcher Rebbe