Not only does Google check the anchor text in a link on your site, but it recognized the page you're linking to and the actual text on that page.

If you run a site about "red dogs" it is possible for you to rank well for the term "purple cats" if (a) you have a good reputation with Google and are considered an authority site (a directory) and (b) if you link to a page (yours or someone else's) that talks about "purple cats."

I have even seen non purple cats sites rank higher than good sites about purple cats simply because the linking site has a good PR, a good history and reputation, and they're considered an authority site.

You need to remember that in the beginning Google counted numbers of links. So people put tons of links on their pages. Then Google started checking for keywords in the linked text, so people started stuffing keywords in their anchor text ... on it goes. It's an endless game of cat and mouse, as SEO types figure out what works to get good rankings, Google develops and enhances their algorithm to become more sophisticated.

Cheers
Michael