if Bard's men had asked or offered services or some other goods in trade for a part of the treasure ... or if the men of Laketown and maybe even the elves had been willing to approach the mountain alongside the dwarves in the same spirit of good faith that you allude to.

At any rate, there is still something good that comes out of it all in that they are all standing ready for battle when the goblins attack by surprise. Perhaps it served all of them well: men, elves, and dwarves alike, to sharpen their spears and swords a bit before the real ambush coming from much less reasonable folks. It's an unlooked for gift of readiness and preparation for a more deadly battle for survival that was preparing without them knowing about it.