Yes, works of the US Federal Government are public domain. It gets complicated when state governments, contractors, etc. are involved, but Direct File was in-house work by USDS/18F.
Yep, one of the more popular FOSS CNC controllers (LinuxCNC) draws its heritage from a NIST project, and at least one major manufacturer ships a variant of it in their machines.