Most albergues don't serve meals, but this depends on your route. Some albergues have a kitchen (although the "kitchen" may not have pans or cooking utensils, just a microwave). Not every village has a restaurant (and restaurants often closed once a week for the staff to have a break), so it doesn't hurt to carry an emergency ration.
Many restaurants along the camino have a "pilgrim's menu" for dinner, typically a starter and a plate with a main dish. If you find other pilgrims to eat with, you can order dishes to share (which is how people generally dine out with family and friends in Spain). Look for tortilla (egg and potato), pimentos de Padron (little mild peppers charred in oil), ensalada de queso de cabra / rullo de cabra (goat cheese salad, request no nuts). Be aware that "frutos secos" is literally "dried fruits", but means nuts. Coffee is not served with sugar added. In a city, look for a vegetarian restaurant (there are at least three vegan places now in Santiago). Many traditional soups or stews with beans are unfortunately also made with pork, so it's nice to look for a place where you can try a pork-free version.
In bigger towns where there is a supermarket, you can stock up on food for a picnic. Look ahead the day before to see what supermarkets are available and what times they are open (many close for the afternoon siesta). I carried a small bottle of olive oil, a small bottle of balsamic syrup and salt- and I ate a lot of superb little supermarket tomatoes on bread or with salad greens. Carretilla microwave meals are not bad and the Ensalada de Quinoa is tasty without heating.
40 USD/day will be fine if you are staying in public albergues (10 euros/night) and making your own breakfast and lunch.
What regions does your camino route pass through? Read up on some of the regional dishes on wikipedia, eg: