Short term or long term?
If MS had bought Yahoo and run it into the ground, that would mean a short term bonus to investors but eventually the loss of ALL investment. Now someone with a large block of shares can keep an eye on it and dump them to maximise THEIR value, but the majority of shares are for people who don't have that option and their value is far, far less.
By refusing MS, Yahoo may believe they can continue to make acceptable profits giving a continuing revenue stream that advantage ALL shareholders and therefore realise a better investment when taken to a long-term view of "profit".