In some cases a library is about accessing a proprietary algorithm, but it's much more common that a library is used simply because it's cheaper and to licence an existing, performant, well-tested implementation rather than paying to develop your own.
There can't be that many proprietary algorithms out there?
It isn't always cost effective to develop your own alternative to libraries such as Scaleform, SpeedTree, Euphoria, etc. when you can licence the existing library, and even get support from the creator. In some cases you might also gain access to proprietary algorithms or services, but it's more about saving cost and effort.
//EDIT: Beaten to it -- well answered Daark!