How much should NPCs charge for spells cast as services to PCs?

As the title suggests, I need to know how to compute the appropriate cost for spells that NPCs provide as services (components included) to the party.

My search has come up with the following:

1. There is no standard method described in the PHB, DMG, or even the MM (the only books I have). Except in PHB p.159 Spellcasting Services where it is described that:

Hiring someone to cast a relatively common spell of 1st or 2nd level, such as Cure Wounds or Identify, is easy enough in a city or town, and might cost 10 to 50 gp (plus the cost of any expensive material components).

2. In the Tyranny of Dragons Playtest Player Guide p.11 there was a "Spellcasting Services" table stating:

• Cure wounds (1st level) 10 gp
• Identify 20 gp
• Lesser restoration 40 gp
• Prayer of healing (2nd level) 40 gp
• Remove curse 90 gp
• Speak with dead 90 gp
• Divination 210 gp
• Greater restoration 450 gp
• Raise dead 1,250 gp
3. The same table states that:

The number of spells available to be cast as a service is limited to a maximum of three per day total, unless otherwise noted.

4. Based on that (I think) people have come up with the following formula:

Spell Service Cost = Square of the spell level, then multiplied by 10, add double of the consumed material cost, add 10% of nonconsumed material cost.

5. Found a related conversation for 2-4 on reddit. I have no idea if it's RAW or RAI (Rules As Intended) or just House.

I'm interested on a RAW answer; failing that, I'll take a RAI (Rules As Intended) instead.

The answer to this is two-fold. So, to give the TL;DR first...

The Equation you cited is most likely accurate, but it only applies to Adventurer's League play. It is not part of the core rules.

Where the Equation Comes From

The pricing model that you cited in your answer, is derived from the Adventurer's League guides. As you mentioned, there was the Tyranny of Dragons Player Guide....but there are also the following...

These are published by Wizards of the Coast, but only apply to Adventurer's League play. The equation cited...

$$(\text{Level})^2\times10+(\text{Consumed Materials}\times2)+(\text{Non-consumed Materials}\times0.1)$$

was derived by the player-base because it accurately matches every cited "Cost to have this spell cast" entry in the Guides. To my knowledge, there are no exceptions. Every listed spell can have its cost computed with this equation. Which, given the sample size, means the equation is most likely right.

So, while this is not a "Rule" as laid down by WotC, it is an equation that can accurately predict the costs that they have cited for Adventurer's League play. And, in mathematics, if you have discovered an equation that can reliably predict all the results you know you have: we call that an accurate equation.

Again, just to be clear: The list of spellcasting service costs published by WotC is Adventurer's League content, not core rules. Additionally, the fact that players figured out this equation does not mean it can be applied to any spell in AL play. The only spells available for purchase in AL play are the ones explicitly listed in the guides. (So you can't just hire someone to cast Wish for you for 810gp.)

RAW

The only thing existing in the Core Rules is this:

People who are able to cast spells don't fall into the category of ordinary hirelings. It might be possible to find someone willing to cast a spell in exchange for coin or favors, but it is rarely easy and no established pay rates exist. As a rule, the higher the level of the desired spell, the harder it is to find someone who can cast it and the more it costs.

Hiring someone to cast a relatively common spell of 1st or 2nd level, such as cure wounds or identify, is easy enough in a city or town, and might cost 10 to 50 gold pieces (plus the cost of any expensive material components). Finding someone able and willing to cast a higher-level spell might involve traveling to a large city, perhaps one with a university or prominent temple. Once found, the spellcaster might ask for a service instead of payment--the kind of service that only adventurers can provide, such as retrieving a rare item from a dangerous locale, or traversing a monster-infested wilderness to deliver something important to a distant settlement.

Emphasis Mine, From PHB 159.

Many of the rules that exist in Adventurer's League books exist to provide a 'standard' where one does not normally exist in the core rules. This is to provide predictability, balance, and consistency between sessions where you may be playing under multiple different DMs throughout the 'campaign.' These are not Core Rules.

If you wish to adopt them and use them, you can. But this is not a rule. The official rule for how much it costs to have a spell cast for you is: "However much the DM says it costs, and 'services rendered' may be demanded in lieu of coin."