That will save a LOT more money and have a better impact.
Group A gets $Z in donation with conditions attached so it only gets used by Group A.
Then the organization assigns $X - $Z funding to Group A and assigns $Y + $Z funding to Group B. Group A is happy because it still has $X from the donation and doesn't complain. Group B is happy because it can now spend $2.5 million on the CEO.
1. Limits. The above doesn't apply when $Z > $X, above which the attachment has full effect.
2. Reputation. The sources of recurring $X + $Y have decision making powers with a time lag. They may not be willing to give $X + $Y again if they know it was entirely spent on group B last time.
3. Anticipation. Organization decision makers know 2. Which makes donations with conditions attached into a signal with some effect, rather than something freely fungible with no pressure.
If we were to plot a curve of notional pressure and effect on the organization's budgeting decisions, I would expect a curve increasing with the ratio $Z/($X+$Y). A very shallow curve perhaps. But not a flat zero in the range 0..$X as you are suggesting.