One solution is to use flexible cables, locks, and adhesives (see Tryten for some examples). This offers a simple and inexpensive solution.
I also found a clever solution at http://www.ianchor.net. The iAnchor physically fixes an iMac computer to a tabletop or desk surface. It also secures the keyboard and mouse cables so that these devices stay with your Mac.
If your iMac does get stolen, there is some hope – there is a software solution called Undercover (http://www.orbicule.com/undercover/mac/) – Have a look at their guided tour – pretty neat stuff.
Note that I haven’t actually tried these solutions and there is probably more that can be found on the Internet.