Since global warming is a global problem (and other forms of pollution from burning coal or gas can travel long distances) it doesn't matter where the carbon is saved, it's basically equivalent, so they're just being pragmatic in their philanthropy.
This could be thought of as a subset of their wider goal to be carbon neutral (which again, could be described as philanthropic in nature), presumably funding the roll out of renewable energy seemed like a cost effective way to work towards that goal.
Edit: as the energy they buy is sent into the grid, if all companies do this, the renewable energy can be sufficient to power all companies, so I guess that makes sense
If people did use this model to get to 100% then presumably the final 20% or so would be more expensive, since you'd still be paying grid prices for your usage, then selling the same amount of renewable power to try to cancel out that cost. If that renewable power is worth much less, because of integration costs, then you'll be paying much higher costs overall.
(Note, paying much higher costs is a good thing, since it gives a market incentive for people to invest in storage technologies, demand/response, efficiency etc. This is similar to big companies like Microsoft changing an internal carbon tax to redirect investment).
And why do they sell at loss the energy ? Does this mean that they just exchange the energy they buy for grid energy to power their datacenter, and that the energy they get is cheaper than the one they're buying?
By the way, carbon neutrality is easier to achieve than 100% renewable. Google has been carbon neutral since 2007,[2] which means that they purchase carbon offsets for their carbon usage. Carbon offsets are cheaper than renewable energy credits because there is lower-hanging fruit. For example, agreeing not to clear-cut a forest for 20 years generates millions of tons of carbon credits.
[1] https://en.wikipedia.org/wiki/Life-cycle_greenhouse-gas_emis...
[2] https://googleblog.blogspot.com/2007/06/carbon-neutrality-by...