Buying a car is not the issue, really, it is getting it registered in your name. I am not aware of any countries where you can do that. I am aware of two alternatives though. In this answer I will focus on the Dutch side of these things as I am most familiar with them. Note that I am not a lawyer and I may be missing factors.
Option 1: registering as a resident.
This is a lot easier than it might seem, as you only need to be a resident at the time you are registering the car in your name. You will have to find a place where you can register, though. There are a few consequences, like having to get health insurance and effects on government support the people already living on the address might have. The registration takes no more than a few days usually. I am unaware of how difficult this would be for a non-EU citizen, you could consider asking this on expats.se. In case you buy an old timer car (25 years or older), you can then emigrate again without any troubles, as they don't have to pay any taxes. They do need insurance, though! Getting insurance and then leaving should work fine, as long as you always pay.
Option 2: German export license plates.
This is more of a short term solution, but perhaps suitable for you. If you buy a car in Germany for immediate export, you can get export license plates valid for up to a year. These are (to my knowledge, and certainly in Netherlands) legal to drive around with outside of Germany till they expire. More information (in German) can be found here: http://www.ksm-online.de/.
Added by Dennis:
To add an alternative, the UK seems to be quite relaxed about non-resident car owners (it may be that they assume you are resident but nothing involves checking that) and will register the car if you have a UK address to receive correspondence. Many UK insurers will provide insurance for foreign-licensed drivers only with a requirement that they get a UK license within a year, but there are brokers specialising in finding policies for those who won't ever have a UK license so this is apparently not uncommon. The downside of a UK car for travel in continental Europe is obvious but buying, registering and insuring one is at least possible for a non-resident with a UK address to use.