In the United States, if a university lab develops code while receiving public funding, are they legally obligated to release their source code?
No, in general they are not.
It is true that works prepared by US federal government employees as part of their official duties are in the public domain. This applies, for instance, to journal articles by scientists at DOE or DOD laboratories. It does not apply to public university employees (they work for state/local governments) and, as far as I know, it does not apply to computer code.
All the work done for an employer belongs to the employer (the software belongs to the University, not the research group). The employer, depending on its legal status, might have some legal obligations in terms of copyright and IP of the work it is done on its behalf. In addition, when the funding comes, it comes with, or without, a number of other specific obligations about copyright and IP. These are potentially overriding those imposed by the employer (because the employer accepts the funding and the conditions).
So the answer to your question is: check if there are any conditions attached to the funding (which are pertinent only if they fund the project) and if there are any condition your employer needs to fulfil.