OS, Google "ground source heat pump" for your answer. Residential scale ground source heat pumps are more and more common today. There are two means of coupling the pump to the Earth. Both are taking advantage of the fact that somewhere around 20 feet underground, the temperature is fairly constant, both Winter and Summer. Note that in Northern climates with permafrost a few feet beneath the surface, the first of these techniques cannot be used. Water, often with added anti-freeze, is the fluid that carries heat to and from the heat pump, in a "closed loop" where the antifreeze is circulated continuously.
The first technique called "horizontal bore" is suitable for land where there is solid bedrock or gravel or mixed rocks, boulders etc a few feet underground. The surface soils are bulldozed or dug away, into careful piles that segregate topsoil from subsoil or clay/gravel. Then large coils of continuous piping are laid in place, with a foot or more of soil underneath and several feet (the deeper the better) above. Then the soil layers are carefully restored over them in the reverse sequence, so that you end up with clay/gravel under subsoil which is under topsoil, and the land still supports vegetation. Here is a typical horizontal bore installation, which can be performed by excavation contractors with a variety of equipment to dig or bulldoze:
![Image](http://www.real-world-physics-problems.com/images/3_ton_slinky_loop.jpg)
The second method is called "vertical bore" and is used where bedrock is close to the surface without enough soil layers for digging/restoring, or where the land available is too small for horizontal bore. Boreholes are drilled in the earth using the same sort of drill rig used for water wells. Then a single pair of rigid plastic pipes are slipped into the hole, after a "U" coupling is heat-welded on the end. Finally the hole is pumped full of a thin concrete called "gunite" leaving 1 to 2 feet exposed above the borehole for connection to buried plumbing.
![Image](https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcSHSHaSs_ecGjurnC0R1cNXg3gbheZu_0PbuLUeceDSn-EqJhOg)
![Image](http://azgeology.azgs.az.gov/sites/azgeo.azgs.az.gov/files/conway_fig-3.png)
The cost of vertical bore can be quite high in areas with solid bedrock, as two or more bores are often used. You will be paying for every foot drilled into rock using an expensive carbide or diamond burr drill.
There is also a cost-reduced form of vertical bore which is used where the water table is high underneath the house, which involves a single bore and no gunite. The well bore is drilled down to the water table, and then 100 feet or so further down. Then the closed pipe loop is simply immersed in the water of the water table, and metallic piping can be used in this case:
![Image](http://farm4.static.flickr.com/3173/3046299459_17e7f24356.jpg)
This form of so-called "geothermal" heat is often used on the shores of lakes and rivers, where the water table is close to the surface.
Inside the house the constant temperature water has a Freon (i.e. refrigerant) loop immersed in the water tank, which pumps heat into the water in Summer for A/C, and out of the water for Winter for space heating. Frequently a seperate smaller heat pump is used for domestic hot water, for both heating and cooling seasons - but it's more efficient in the Summer, when excess heat from the living space is being dumped into the same closed groundwater loop.
![Image](http://www.airideal.com/geothermal-heating-cooling/_img/geothermal-graph.png)
The Freon refrigerant can either be used to warm/chill air in a forced air system, or to warm/chill yet another closed water loop embedded in the floors (more efficient and comfortable, but higher cost).
Ground-sourced heat pumps are the ultimate in efficiency, but MUST be matched fairly closely to the heating/cooling loads for maximum efficiency, which requires modelling the heating/cooling needs of the residence and sizing the pumps and ground bores to the needed heat flows, and professional installation. Not to mention, the use of earth moving equipment or drilling rigs. The afore-mentioned air-to-air heat pumps are more suited to DIY use, and can even be had pre-charged with refrigerant and with pre-charged lines to connect the units inside with the outside heat exchanger. Air-to-air heat pumps are less effcient than ground source heat pumps, but very much cheaper, and will do a great job in more moderate heating zones.