If you're firmly going to buy a house in 2-3 years, putting a down payment into stocks just adds volatility to the amount you're putting down, meaning volatility to the type of house you're able to afford and/or whether or not you are able to afford a house at all. Stocks usually go up 10% ish as a long term average, but they could easily go down 20% in both of the next 2 years.
If you're willing to take the risk and maybe wait up to 3 more years or something to actually buy a house, probably putting them in stocks helps you because the money grows faster. But most people, for lifestyle reasons, want a house in the next 2-3 years and that timeline is firm and not really relying on that money to grow. That is why the advice is usually a CD or high yield internet savings account like Ally or Discover.