They took a big bet on it actually happening and ended up getting the funding.
Though, not sure it was actually a huge bet really. Even if they never received that funding, this was most likely a profitable venture.
This funding is actually part of the promise made to TSMC to not build manufacturing plants in China a few years ago. They had plans for several chip manufacturing plants in China When Trump promised federal government funding for future plants in the US if the didn't build the plants in China.