I don't know the story, but 4.3BSD, which went into NeXTStep, was not open source. It wasn't until 4.4BSD that BSD was available without a paid Unix license.
NeXT tried to get away with a closed-source fork of GCC for Objective C, but eventually backed down under legal threat.