Depending on your country, him paying out of pocket for business expenses does not necessarily mean he privately owns the product of those expenses. I would guess that in most countries, if he made it clear that this was for the company, and let you work on that code, i.e. "donated" the product of the expenses, then he is simply owed the amount by the company. He borrowed money to his company, in short. A court would easily see through that argument.
Now, that is but a tiny legal detail -- I think the other comments on interpersonal relationships are much more important. He can screw you if he really wants to, and so can you.