a.) A huge part of GitHub's value is their default-ness. Anybody can build a website UI to git, although it is a lot of engineering work. Gitlab and Bitbucket are somewhere in that equation.
People uneasy about MS are all over the Internet talking about moving off of GitHub today. MS announcing that they are open-sourcing GitHub would instantly evaporate a lot of that doubt/resentment/NOFUCKYUOM$!!!!URRRGH.
b.) They could also open-core it, not totally open-source it, just like GitLab. Thereby keeping basically all of the more-lucrative enterprise business (that's probably way more comfortable with Microsoft anyway).
For that reason, they have a strong incentive to keep people happy and on github, and they have a huge incentive to make it easy to deploy from github to azure with a single click or something similar.
So, literally not open sourcing it, which defeats the purpose.
They don't lose any customers by open sourcing it. Nobody's going to use GitLab if they can just download GitHub, and companies will still pay for Enterprise because they still need support for their massive investment in GitHub's extended features.
[1] https://medium.freecodecamp.org/the-top-contributors-to-gith...