"More expensive to make" doesn't necessarily justify "more expensive to buy". One would need to quantify how much more expensive the tighter tolerances and better molds actually make a package of bricks and compare the resulting margin to that of other plastic toys.
I worked for a toy design firm during the mid-90s. Though I did software, I managed to learn a bit about this stuff (osmosis, helping with CAD/CAM, eavesdropping, etc).
Tool die design for injection modeling is an art, a craft.
Lego's die tools are smaller, meaning they hold many fewer parts. They had more supply channels. So the parts would be formed more uniformly. I forget what they did to ensure the parts cooled more uniformly.
At the time, Mega Blocks were far inferior. The were using larger dies, more parts per die. So their bricks weren't as uniform. We used to bring in lots of other toys for inspection and play testing. I once assembled a Mega Block tank set. It just wouldn't stay together, with ill fitted pieces fighting against each other. The differences weren't even visible to the eye. Lego bricks just had better heft and fit.
Also at the time, and I imagine is still the case, Lego and Playmobile were the gold standards for plastic molding toys.
I'm just saying that you can't claim a price differential is justified by a cost differential without actually doing the math and providing X% cost differential ~+ X% price differential.
Because absent those being equal, we have to consider that there are more factors and without context we can't even determine the relevance of the cost factor.
In my view, the price differential exists simply because it can. People will pay $10, $20, $50 or more for a box of Legos. They grumble, sure. But they still buy them. I buy them because they work well, they're partnered with brands and properties that people also really like and they execute well in the tone and context of those brands.
But I'm of the mind that prices for all non-commodities are set by willingness to pay and costs are a function of how much profit corporations needs to justify their investment.
Ergo, that Lego spends more to make the pieces well is a consideration toward their profit margin. Not the price.