It was a win-win either way for Tesla. Worst case scenario for them, they got an interest free loan. They could've just put that money in a savings account and made free money off the 1% interest.
At the end of the day Tesla was able to guage demand, get hundreds of thousands of orders placed (even with the refunds) and get millions of dollars to use for investment/production.
Yeah ideally for Tesla no one would all for a refund, but I'm sure they expected some and this still seems like a big win for Tesla.