If the nofollow attribute was built for anything, it was built for comment spam. Yes, if you do not remember, Google and the search engines worked closely with MovableType, WordPress and other blog and forum systems to help them build in the nofollow attributes to help save their search index and to help reduce comment spam. That was one, if not the single most important, reason behind introducing the nofollow attribute. It has thus been expanded for other things, such as any paid link or PageRank sculpting (it gets more complicated).
Anyway, I found an interesting thread at Google Webmaster Help which talks about the nofollow and link building through comment spamming. One thing you do not want to do is ask Google if it is okay to drop comments on blogs with the sole intent of building links. But people do crazy and wild things in official Google forums.
I was initially going to name this post, Google's final word on what the nofollow attribute blocks, but then I saw JohnMu at Google somewhat mocking the use of comment spam for link building. Hence the new focus. Let me pull out the reply from John.
Going back to the original question, commenting only with the goal of getting links is a bit lame, in my opinion. Do you honestly think that any site owner appreciates comments like "I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenter here! It's always nice when you can be informed In such way,I'm sure you had fun reading and watching this post. san diego wrongful death attorney" or "It would also be useful have the plugins categorized a little better on the website. Browsing them is a pain the backside, since you have to go thru about 10 million social plugins that are a waste of time when you specifically need web dev tools. Domain Names Australia" (both taken from our blog's spam queue this morning)? That's just pure spam, and if you're contributing to it by posting more comments like that, then I know a few people who would like to talk to you out back...
He gives two examples of poor comment spam. You and I see it every day, it is nothing new. If they get passed my spam filters, I try to manually block them - some always slip by.
But then John ends with the line that I love, "if you're contributing to it by posting more comments like that, then I know a few people who would like to talk to you out back..."
Sometimes I love the honesty here.
And what is Google's official word on how the nofollow works?
Let's be absolutely clear about this: Links that use the rel=nofollow microformat do not pass PageRank and are not used in our ranking algorithms.
This does not mean that the target URL will never be crawled. By adding a rel=nofollow to a link, you're essentially removing a sign pointing to the restroom. Just because that sign is gone does not mean that Googlebot will never find the restroom. Using rel=nofollow is not a way to block crawling altogether -- if you need to do that, then use the robots.txt file.
Forum discussion at Google Webmaster Help.