I'd also want to include utility in there as a pricing factor. Something can be (relatively) common but really useful all the time, while something else can be rare but only useful in very special circumstances; and IMO the pricing wants to reflect that a bit.
For example: a straight +3 sword is useful all the time to a swordsman, while a much rarer +0 sword that's +10 vs demons is only really useful if-when that swordsman is fighting demons. I'd probably price the uncommon sword higher than the rare one in this case, or at best have them on par.
There was an interesting experiment I read about recently. People set up a new "high end" shoe shop in a fancy mall, staffed it and then stocked with with shoes from payless. The shoppers went gaga over the merchandise and paid an exorbitant price. Utility and quality often have little association to each other.
But rarity does break things up by utility - a +2 sword is higher rarity than a +1. Xanathars also breaks it down further into major and minor. Not perfect, but nothing ever is.