Is the ticking of a free spinning wheel related to its quality? I have often noticed that, whenever a race bike is running with free wheel (so no active pedals movements), I can hear a distinct "tick tick tick tick" coming from the rear wheel, sounding more or less like a speedy clock.

That doesn't happen neither on my cheap city bike, nor on my more expensive tourism bike. Is it a matter of proper lubrication, or is it also an indirect index of how good the gear is?

I would guess that if I hear a sound, some energy is being spent to generate it, and that energy comes from the bike motion. Therefore I would assume that a better bike with lower resistance would be more silent.
No.  Expensive hubs that roll well can be loud or quiet.  Cheap hubs that do not roll well can be loud or quiet.  

There are numerous factors that go into the sound that a hub makes while freewheeling.  Among them are design (engagement points, engagement design, etc), the shape and design of the hub (the sounding chamber to some extent), the material the hub is made out of, the amount and type of lubrication in the system, the drive train running the hub and lastly the build of the wheel itself.  All that being the case it's not possible for the average cyclist to listen to a hub and determine it's quality.  A skilled mechanic may be able to listen to a specific brand and model of hub that they are familiar with and have some idea if is in good working order, however, that is a level of expertise you'll rarely encounter.