Why paying for code does not make it yours
Copyright starts with the person who creates the work. The main exception is a work made for hire, where the hiring party is treated as the author. The US Copyright Office explains in Circular 30 that this happens in 2 situations: when an employee creates the work as part of their regular duties, or when a certain type of work is created under an express written agreement with a party that specially ordered or commissioned it.
The catch is the words certain type. A commissioned work only qualifies if it falls into 1 of 9 categories: a contribution to a collective work, part of a motion picture or other audiovisual work, a translation, a supplementary work, a compilation, an instructional text, a test, answer material for a test, or an atlas. Custom software from an outside company usually fits none of them, so a work for hire clause on its own may not do what you think it does.

