I did have a bit of a play with it. Not sure how you’ve got yours set up. I’ve tried a very basic test install, just WP 3.0.3 with a couple of pages and some posts with the default theme. I put that code block at the top, and it worked how I think you wanted it, i.e. the homepage, https://www.domain.com/, shows the dofollow link and all other pages, including posts, show nofollow.
Any chance we can have a peek at the site?