There are two options here. (At least, maybe more.)
(1) Follow the standard D&D rules (I know the ones in B/X and AD&D) for assigning values to gems. So each gem has an "objective" value, which is determined by rolling on the relevant tables. In the fiction, as best I can make sense of these rules, that "objective" value is based on size, clarity and cut.
On this approach, if a diamond or ruby becomes more valuable in the market because of its fame/association, then that is not a factor for spellcasting purposes. And the GM would need to track its "objective" value alongside its "market" value. (By analogy, an ordinary longsword has an objective value given in the price list, but might have a higher market value if it was once wielded by King Thrommel.)
Yeah, it would need the GM to track both values for the same ruby, its rubiosity value for the purpose of spellcasting and its market value for the purpose of selling it. Also, the "objective" value isn't size, clarity and cut. These qualities are objecive, but they don't, by themselves, create value if there is noone to prefer them bigger, clearer and faceted.
A ruby with a $5000 objective value is worth $5000 because people
want it based on its cut, size and clarity, because they like rubies of a certain size
right now, in our current context. Much like they will pay more for an item owned by KK, since they desire such an item. So in both case, the value comes from people's desire, but only some reasons for wanting it (and being ready to pay for it) contribute to its usefulness to spellcasting.
That's... really strange-sounding as an explanation for when in-universe scholars (ie, PCs) try to determine the behavior of their rubies (I had to design adventure over my PCs wanting to prove Morgrave university that rabbit had souls and designed experiments to scientifically approach the question, so I wouldn't be surprise this rubiosity to be questionned by inquring minds). Especially when they notice that a big cabochon ruby ground to dust can power the exact same spell than the smaller amount of ruby dust you get when powdering the gem coming from the big cabochon, turned into a much smaller but more valuable faceted cut (assuming that the cabochon value, determined by the tables when you find it, is the objective value).
Which leads to the question, what is the spellcasting value of the ruby dust you get by grinding the by-products of faceting your big ruby? It should be none (since all the rubiosity is in the main gem), so there is ruby dust that is worth something on the market, and that can't be used for spellcasting. And this zero-rubiosity byproducts can be cut into small ruby with a market value themselves (like the Cullinan II to IX and 96 minor brillants made from the Cullinan diamond. It will puzzle scholars for years (I assure you, sometimes my players do kills orc and take their stuff, too). And so its possible to by a $5000 ruby on the market, that people desire because of its size and cut, and yet has zero objective rubiosity value for the purpose of spellcasting, if it was made from the byproduct of cutting a larger diamond.
(note for the trivia I learnt thinking of this: The largest part of the Cullinan diamond was after cutting valued 2.5 times the rough diamond despite being 1/6 of its size, according to the Cullinan wikipedia page.)
(2) Treat the increase in market due to fame etc as also being relevant to spell casting. In this case, only one value needs to be tracked.
I
think the game probably assumes or defaults to (1), though it's hardly clear on the matter. I don't think that (2) will break anything at all.
EDIT: I see that
@Maxperson favours approach (1). But you favour approach (2). To my mind, both are completely fine as far as game play is concerned.
I really favor (2) in this case because (1) sounds really jarring to me (and opens questions like the one above), with two values being tracked separately, especially when the "objective" value isn't a physical measurement (like weight) but a subjective measurment (it's cut in a way that local think is pretty right now). So if I find a gem in an ancient ruin cut in cabochon (the most prized cut for Romans who considered faceted gemstone vulgar) it has a rubiosity value of $5000 for spellcasting purpose, is worth $2500 on the market because the cut is meh by today's standard but can be cut by an expert lapidary into a $10000 ruby by making it into a cushion cut. If the objective value is $2500, that's three values to track, the objective value, the rubiosity value, and the market value in its potential, actually sought-after state -- but if I teleport to another place where cabochon are still in favour, I switch the values for faceted and cabochon on the market. I much prefer (2), with a single value to track, depending only the market value, with sentient magic so we don't get shenanigans between PCs and there is a reasonable explanation in-game (the size of the diamond doesn't matter, but the spells contact the god of death and compels him to listen to your plea. Sacrificing so much wealth over a dead comrade proves your love for him and moves the god so he accepts to try and put its soul back in the body.).