It won't cost them billions
It will just cause purchases to be delayed. People looking to buy a Mac or iPad have already made their decision between "Mac vs Windows" or 'iPad vs Android tablet" so they won't be lost sales for Apple (especially since Windows PCs and Android tablets are affected by the same shortages)
It will just cause some purchases to be delayed, but they won't be lost. The only "cost" is in terms of next quarter's results being lower than they could be, but some future quarter's results will be higher than they otherwise would have been.
The fact Apple is able to sell iPhones in such numbers despite the shortages show how well they've managed their supply chain and purchase agreements for their #1 product.