Consider a company with 1T shares that's valued at $1T with $100B of cash. Presumably, $100B of that valuation is for the cash, because investors know they could give that money back through dividends or the like. Let's say the company buys back 100B shares for its $100B. Because the company no longer has the cash, the overall value decreases (to $900B) to the same degree that there are less shares on the market (100B less).
You should think of a stock buyback as another way of paying a dividend without triggering a taxable event for stockholders. The value transitions into a greater price of the now-fewer-outstanding shares.
Consider a company with 1T shares that's valued at $1T with $100B of cash. Presumably, $100B of that valuation is for the cash, because investors know they could give that money back through dividends or the like. Let's say the company buys back 100B shares for its $100B. Because the company no longer has the cash, the overall value decreases (to $900B) to the same degree that there are less shares on the market (100B less).