I'd always thought that hiring a photographer was automatically work for hire and that the person who paid owned the copyright. However, as Walmart has just found out, that isn't the case. Absent a specific, written transfer of rights from the photographer you don't own the rights to works you commission.
Work for hire changed in 1976