Nations(companies) have no permanent friends and no permanent enemies, only permanent interests.
Microsoft has a permanent interest to lock you in a box, paying tax. Open sourcing some products or whatever PR move is orthogonal to that, that's why they can do it.