According to the HTML Purifier documentation Attr.EnableID must be set to true to fix the behavior. I checked class.html.inc.php and found that that the value IS set to true: $config->set('Attr.EnableID',true). I'm not sure why it isn't working but I guess that HTML Purifier removes the attribute to prevent XSS as in script name='foo'.
The workaround is to enable and use the 'id' element of the 'a' tag.