From the article: “ The Virgin and Child with Saints Louis and Margaret and Two Angels was bought for just over $20m (around £16m at the time), funded by the American Friends of the National Gallery London.”
Regardless of where it came from this time, it's a charity, not some sort state gallery department funded by the treasury.