Comment I'm a law student . . . (Score 1) 504
And this question is governed by the work made for hire doctrine (http://en.wikipedia.org/wiki/Work_for_hire). Ownership depends on whether you are an employee or an independent contractor. Which of these two you are depends on separate analysis. If you are an employee then the boss owns the lot. However, if you can prove that you are an independent contractor, then the code belongs to you because it is not in the 9 statutorily-defined categories in Section 101 of the Copyright Act.
Interesting question.
-- Noah
Note: I am not an attorney and the preceding comment is NOT intended as legal advice.