I'm always interested when CD inlays include little sections about the inspiration and writing of the songs. Usually there is a combination of both - even by the same songsmith. Sometimes they have an idea to base some lyrics on, and other times they're just humming along when an interesting melody turns up. Obviously in a perfect world, the lyrics and tunes would match up.
Oh well
JE