First, I want to elaborate a bit on the economics behind some of this. As many people already mentioned, this is going to vary greatly from country to country. Why? Well, raw commodity prices are very volatile, due to varying government subsidies, differences in climate, extreme climatic events, supply chains, &c. The supermarket industry in the US is extremely competitive. SuperValu, for example, is a giant corporation that owns many supermarket chains. They are lucky to eek away a 1.5% profit margin. (In other words, at most 1.5% of their gross income is a profit.) That means they could lower their prices at most ~1.5% without taking a loss. Bulk sellers like Costco and even the giant Wal-Mart are lucky to reach 3%. Successful fast food restaurants like McDonalds, on the other hand, easily reach a profit margin of 20%. That means, in effect, McDonalds could reduce their prices by ~20% and still stay afloat.
Why is this? One major reason is that companies like McDonalds can and do have complete vertical integration of their supply chains: McDonalds raises their own cattle, grows their own potatoes, transports their own raw ingredients, and largely owns the real estate of their restaurants. In fact, McDonalds even makes a profit off of leasing their real estate to McDonalds franchises. That flexibility is partially one reason why a Big Mac will be worth the equivalent of US$10 in Brazil while the same Big Mac will be worth US$1.50 in Croatia. Supermarkets don't really have much opportunity for vertical integration unless they actually buy and operate their farms and suppliers.
Now, to the question of whether eating fast food is cheaper. As I mentioned in my answer to the food deserts question, at least in the US there is a definitive link between poverty, obesity, and lack of proximity to a supermarket. There was also a study in the UK that discovered a correlation between the density of fast food restaurants and poverty:
Statistically significant positive associations were found between neighborhood deprivation [i.e., poverty] and the mean number of McDonald’s outlets per 1000 people for Scotland (p<0.001), England (p<0.001), and both countries combined (p<0.001). These associations were broadly linear with greater mean numbers of outlets per 1000 people occurring as deprivation levels increased.
Update: I re-wrote the following paragraph to include a rigorous argument.
Let's have some fun now and look at the Consumer Price Index (CPI), which estimates average expenditures for various goods over a month. The current CPI in the US for food and beverages is $227.5 (meaning that the average consumer spends $227.5 per month on food and beverages). Now let's assume that the cost of non-fast-food is cheaper than eating fast food and proceed with a proof by contradiction. Under this assumption, the CPI of $227.5 is obviously a lower bound on the amount one would spend if one only ate fast food (since the CPI includes all types of food-related expenditures). This equates to about $8 per day. In 2008, the average price of a Big Mac in the US was $3.57, and it is certainly possible for one to subsist off of two Big Macs per day. That's especially true since a Big Mac is one of the more expensive items on the McDonalds menu. A McDouble, for example, costs only $1. This is a contradiction, i.e., we have shown that it is in fact possible to live off of less than $8 a day of fast food, thus breaking the lower bound and invalidating our assumption that eating non-fast-food is cheaper than eating fast food.∎
This suggests that it is at least plausible that eating fast food could be cheaper than grocery shopping in the US. This is of course under some tenuous assumptions, but one can't really definitively answer your question without actually studying the average cost of groceries.