Along with PageRank that everyone talks about, Google also stores lots of information about what it finds on each page it crawls. This includes words used (and count) and words that appear in specific areas (title tag, h1-h6 tags, strong tags, etc). The info the store about a page also includes links out and the anchor text of those links. Basically, they store enough information about each page to get a pretty good idea of what the content on that page is about. This is one of the reasons why AdWords is able to deliver targeted ads, because they know what content is on each individual page.
With that being said, a link from a related site IS worth more than a link from a site with unrelated content. How much more is hard to quantify, but there is a difference. That's not to say I think the type of linking you described in your example is a good idea, mostly because it doesn't seem to add anything for your site visitors...
However, getting links with relevant anchor text from sites with related content is one of the best things, in addition to having quality content, you can do to boost your search rankings