Good pasta is not that cheap. Sure, you can buy cheap ass pasta, but that does not taste good and does not cook well. If you want good quality pasta you need to spend much more. Here in Italy cheap ass pasta costs around 50 euro cents per bag (1/2 kilo), decent supermarket pasta costs about 1 euro per bag, superior quality pasta costs up to 3–4 euro per bag. Obviously, the restaurants don’t buy pasta per half kilo bag, they buy it by very large bags packaged for the food industry which are cheaper.
But pasta is not the only ingredient. You need to make it into a dish by adding meats, vegetables, fats, herbs etc. A basic tomato sauce for 4 is made of a tablespoon of extravirgin olive oil, one garlic clove, a few basil leaves, and a few tomatoes. You can buy cheap ass ingredients (olive oil instead of extravirgin, garlic granules, cheap tomatoes that have no flavor, garlic granules that are sharp and unpleasant) and produce a cheap sauce that does not taste particularly good. If you want to produce a really good simple sauce you need to use top ingredients: really good extravirgin olive oil, flavorful and ripe small tomatoes, etc.
But honestly you don’t go to a restaurant for making the kind of easy pasta you can easily and quickly make at home. You should go to a restaurant to eat an expecially delicate pasta with unusual and flavorful ingredients. Would you like a portion of tagliatelle with porcini mushrooms and truffle (thinly slice the fresh porcini, heat some butter, add the porcini, a pinch of pepper, a pinch of salt, when the porcini are done, add a ladleful of pasta cooking water, then add the pasta, toss to combine, plate, add a shaving of truffle and a pinch of parsley. That’s just as fast, but it requires much more pricey ingredients.
Then there is another element that makes a dish like that cost quite a lot in a restaurant: service and location. When you eat at a restaurant you do notjut pay for the food, you pay for the kitchen workers, for the front of the house workers, for the space itself, the furniture, the advertsing, etc. These elements all build up the price, and how much they do is not relative to the cost of the raw materials.