It transfers money from the company to the owners, just like dividends do. Other than possibly providing different tax outcomes, share buybacks and dividend payments are completely equivalent. Any shareholder can take their portion of the dividend/buyback as either as ownership of the company, or as cash, by trading the relevant amount on the market.
This is actually not true because it ignores the fact that a company's shares could be trading cheap or dear. One dollar in the form of a dividend payment is always worth one dollar (ignoring taxes), whereas if the company can buy in a share with intrinsic value of X for the cost of 0.8*X, then it is "creating value" for the remaining shares. Conversely, if the shares are expensive relative to intrinsic value, then a buyback destroys value for the remaining shares.