The Akeidah explains that Bnei Yisrael sent the meraglim with the best of intentions. They probably spent 40 days davening on the spies behalf, eagerly awaiting their return with a report of how to best conquer Eretz Yisrael so they could finally be on their way. Mashal l’mah ha’davar domeh: think of how the great ba’alei mussar spent the 40 days from Rosh Chodesh Elul until Yom Kippur davening and preparing themselves. The 40 years in the desert was not a punishment – it was the schar for these 40 days! By rights, Hashem could have wiped out the entire generation in one shot, but instead he extended their lifetimes for years and years.
The She’eiris Menachem adds that with this we can understand a seeming contradiction in Rashi’s comments. Rashi explains “kulam anashim,” that all the people appointed as meraglim were all tzadikim. Yet, later in the parsha Rashi tells us that the meraglim departed with bad intentions in mind just as their return report was delivered with bad intentions. Which is it – were they tzadikim, or were they plotting something evil from the get-go? (Maharal's answer posted here.)
The answer is that both are true. “Shlucho shel adam k’moso.” Klal Yisrael meant well when they sent the meraglim, and so the meraglim gained the benefit of being invested with the positive energy of that shlichus. It is only when the spies returned with a bad report that Bnei Yisrael had a change of heart. However, on a personal level, the mergalim were already plotting to spoil the mission from the get-go.
(An amazing story brought by R’ Noson Gestetner in the name of the Tchebiner Rav: One of R’ Akiva Eiger’s daughters became engaged to someone in another town. RAK”E was already old and could not travel there, so he sent R’ Ephrayim Zalman Margolias in his place as his shliach to celebrate the engagement. Unlike the Beis Ephraim’s usual practice of not lingering at a simcha, in this case he stayed and stayed for the whole party. When asked about it afterwards, R’ E. Z. Margolias explained that shlucho shel adam k’moso, so he wanted to take advantage of every second he could be R’ Akiva Eiger!)