They hired the main developer of CUPS to adapt it for OS X. The license of CUPS ensures they continue to share it - the GPL and LGPL - they even had to explicitly add a licensing exception for Apple's (and other company's) binary printer drivers. I would bet money if Apple had CUPS under a BSD license they would not be sharing their improvements so leisurely.
Really? Because they did that with WebKit. They made huge modifications to KHTML and KJS, released them back (admittedly in kind of an amateurish way at the start), and also open-sourced their proprietary component, WebKit, which wraps WebCore and JSCore up in a nice, manageable interface. They didn't have to, but they did.
They also have a lot of contributions to LLVM/Clang, as well as several other open-source projects.
Of course they had to share webkit, KHTML and KJS were under the LGPL so they had to. What they didn't have to share was the apps based on top of webkit such as Safari and they didn't share Safari.
KHTML/KJS was LGPL, so they had to release it. LLVM and Clang is a better argument, until you realize that Apple hired on the guy from the project after their GCC grand plans collapsed - the only visible reason they shifted strategies was to keep from having to open source components of their proprietary IDE XCode.
It's very well established that Apple is allergic to the GPL, and is willing to pay good money to avoid dealing with it whenever possible.