If this is worth $10 to you, take a look at Locale from a dev named two forty four am. It will use GPS to determine that you're home and set wifi on. When you leave, GPS will tell it you're not home and you can then shut off wifi and 3g/4g will resume.
I should mention that I used a free trial version of the app when it was in open beta, and I never used the location features in it. I mainly wanted it for something that could set my sounds different based on time of day. I ended up going with a different app specifically for that function rather than using Locale. It's got 4 stars after 2,600+ reviews, so it's keeping some people happy.
Unfortunately, the 15 minute app return policy really harms your ability to try this out properly, but most devs that make complex apps like this are fair about emailed refund pleas outside the Market's mechanics.
There are tradeoffs. If you're doing this to save battery life, you're going to lose some of the wifi gains to popping the GPS radio on and off occasionally. However, I think Locale can be set to use coarse cell tower location rather than fine GPS location.
There could also be free or lower cost alternatives to Locale. What you want exists, though. My suggestions might be out of touch with the best app for what you need.