That depends, there are specific diets for, say, cats, and it not only needs to be prescribed (to be able to purchase), but it costs a fuckton of money.
<rant>
Think of it like this: imagine if lactose-free or gluten-free food could be bought only with a prescription. Sadly the prices are already high as it is for gluten-free, but I would rather not get into the reasons here. :)
My girlfriend (LA, US) just left 1k USD on 2 visits to the vet with her cat, for some cheap ass antibiotics, and a "specific prescription-only food". Crazy. All that would have been "free" (not quite, but you know) or at a very low cost for humans around here, in Europe. Not the gluten-free food though!
</rant>