$ground(id) is always 0. It used to show the item id of the item it was representing but does not do so any longer. Not sure when it broke as I haven't been using my ground hunting macros for a while.
Example:
In Shadeweaver's Thicket, Payala Fruit is represented by a *Blue Mushroom ground spawn. When this worked, an /items *Blue would show 28 *Blue Mushroom30619's (where 30619 is the item id of Payala Fruit) and if you did an /itemtarget *Blue followed by an /echo $ground(id), it would return 30619. Now, they are all *Blue Mushroom0 and $ground(id)=0

