These contracts are then transferrable. The manufacturer can start work on a factory knowing they'll get paid to produce the drives.
If the AI boom comes to an end, the manufacturer is still going to get paid for their factory, and if the AI company wants to recoup costs they could try to sell those contracts back to the manufacturer for pennies on the dollar, who might then decide (if it is more profitable) to halt work on the factory - and either way they make money.