I've no idea where the profits made by the commercial subsidiaries eventually go, except that the BBC itself is not allowed to operate for profit. That said, you seem to be missing that giving something away for free and selling it for a profit are not exhaustive of the possibilities. (-:
The key is, I think, that a UK resident should not have to pay anything (other than the license fee) or be subject to advertising to enjoy BBC content.
So something produced for a UK audience can be sold outside the UK and the profits used by the BBC to make more content.
Definitions of these things vary greatly in each country, but a 'non-profit' may sell things, where I am.
What's important is that the 'selling of things' is targeted to 'recoup costs', not 'make profit'.
An example, hosting an event and charging $5 per seat, to recoup the costs of renting the theatre. And to pay talent.
Maybe this is different in the UK?
And, you keep saying "operate for profit", which makes me think it is part of their charter, instead of saying "non-profit" which makes me think of my above logic.