This is an odd one.  _Words_ and _lyrics_ are synonyms (I can't spot a difference between _Who wrote the words?_ and _Who wrote the lyrics?_, or _Learn the words_ and _Learn the lyrics_—except that _lyrics_ founds fancier, as you'd expect from a Greek borrowing versus a native Germanic root). Nonetheless, they do not go with the same prepositions.  

With _words_, I prefer _to_ over _for_:

    The words to this song are great
    ? The words for this song are great

But with _lyrics_, I prefer _for_ over _to_:

    ? The lyrics to this song are great
    The lyrics for this song are great

My guess is, there's nothing principled here, just an _ad hoc_ quirk in how English has developed.

----------------

A couple of other observations.  Both _words_ and _lyrics_ seem to go with _of_ (and possibly _in_):

    The words of this song are great
    The lyrics of this song are great

The (dis)preference of _to_ and _for_ can be overridden by the verb:

    Who put these lyrics/words to this song?
    Who wrote these lyrics/words for this song?