In this sentence, it means "first" - he took out the cost of the event (which someone says costs him "nothing" i.e. he claims it's very little) first, and then the rest went to charity.
This is typical of charity events. "Costs" are taken out, and then the rest goes to charity. A "true" charitable gesture would have been if everything - even the costs - had been donated. Then, all proceeds would have benefited the charity.
See the sentence in the first post: it cost him nothing!
I agree that in a conversation between two people one might say: it cost me nothing, and mean that or very little; but in the context above it does mean that he took his costs out of the take and passed the remainder on. Therefore all his costs were covered.