Well, the money doesn't go up in smoke. They end up paying it to their staff, suppliers, and so on. If the project doesn't pan out, it's actually just voluntary redistribution of wealth and the society is better off than if Sam's investors hoarded that money or used it to buy up real estate or make other fairly safe and boring bets.
An argument can be made that there is some specific and deliberate way of giving out $10T that's more equitable - say, spend it on education, public transport, or healthcare. But if we could all agree on what to do, nothing is stopping us from doing it without Sam's (theoretical) money.