The rule that makes an employer, not the creator, the author and owner of copyright in work created by an employee within the scope of employment - and the much narrower rule for freelancers, under which a commissioned work belongs to the client only if it falls within listed categories and a signed agreement says so.
Copyright ordinarily belongs to the person who creates the work. The work-made-for-hire doctrine is the exception: for a work made for hire, the employer or commissioning party is treated as the author from the outset, owns the copyright without any transfer, and the creator has no rights in it at all - not even the termination right that lets other authors recapture a copyright decades after assigning it. There are two routes into the doctrine and they are very different.
The first is employment: a work prepared by an employee within the scope of employment is a work made for hire automatically, with no agreement needed. Whether a person is an employee for this purpose is decided under the common-law agency test - the hiring party's right to control the manner and means of the work, the skill required, the source of tools, the location, the duration of the relationship, the method of payment, tax treatment and benefits - not by the label the parties used. Work an employee does outside the job, on their own time and initiative, is theirs. The second route is commission: a work specially ordered from an independent contractor is made for hire only if it falls within one of the categories the statute lists - a contribution to a collective work, part of a film or audiovisual work, a translation, a compilation, an instructional text, a test, answer material for a test, an atlas, or a supplementary work - and the parties signed a written agreement saying it is a work made for hire. A logo, a photograph, a website, a song or a novel commissioned from a freelancer is not on the list, and calling it a work for hire in a contract does not make it one.
The practical consequence is that a business that hires a freelancer and does not obtain a written assignment of copyright does not own what it paid for: it has, at most, an implied non-exclusive licence to use the work for the purpose it was commissioned, and the freelancer may license it to others. Well-drafted agreements therefore say "work made for hire to the extent permitted, and otherwise assigned", because an assignment - unlike work-for-hire status - can be terminated by the author after a period fixed by statute. Software developers, photographers, designers and ghostwriters are the recurring cases, and the difference between employee and contractor status has consequences for tax and labour law as well.
The agreement is the whole answer here, and it is cheap to get right and expensive to get wrong: a business commissioning anything creative should have a lawyer draft or review a short assignment-and-licence clause before work begins, and should not rely on a "work for hire" label, an invoice or an email. A freelancer should understand what is being signed - an assignment gives up ownership; a licence does not - and a creator who did work for a former employer or client without a clear agreement may own more than they think. Disputes typically surface when the business is sold or the relationship ends, which is the worst time to discover who owns the code or the brand.
Choose your state. Each link opens the directory page for the city in that state with the most currently published law firms in this practice area; a +n beside the city is how many other cities in the state also have one. The list is generated when this page loads, so a state whose listings have lapsed drops out rather than becoming a dead link.