Well, they are shooting at a per Raptor cost of 100k long term 250k short term. Even assuming it is 4x as much now, that is about 3m for the engines.
The stainless steel only cost a couple 100k$ at most.
Add in some bits and pieces, like flight termination system, thruster system and tanks, sensors and so on, add another couple 100k$, lets say 1 million. All of these are already produced by SpaceX in pretty large numbers.
Then manufacturing cost, is a bit hard to calculated, they are producing one prototype every couple of weeks and most of the labor is in welders and most of the machines are welding robots. Labor cost being the dominate cost.
A large part of the cost would likely be the launch site construction itself, and how you want to amortize to an individual prototype is hard to say.
Then there is another bunch of cost for operations and fuel add another couple 100k.
So I would assume a cost of 3 million to 20 million. I'm giving this a pretty large range because its a guessing game. Over the course of a year they tested about 10 increasingly complex prototypes. That would at the high end be a cost of 200 million for one year of this process, if we ignore the design cost.
Consider that NASA SLS has a budget of about 2.5 billion a year including ground system (and that has been going on for 10+ years and will go on for many more), SpaceX is basically nickel and dimming a launch vehicle of that size.
Elon Musk has a couple of saying along the lines of 'if its long its wrong' regarding development. Spending 50% less time while blowing up prototypes regularly is cheaper then spending longer on the project overall. A lot of the things SpaceX does is novel, so no matter how much design work, nobody has ever flipped a deep cryo methane tank and started a full flow staged engine with torch igniter.
Working the perfect design for this on paper would take incredibly long and even then you might have to start over again and once you finally test it.
This is certainty an expensive program, but compared to Starlink is seems less insane in terms of cash burn. Doing both together is a bit extra insane, but on the other hand if you have Starship, the cost of Starlink drops to pretty absurdly low level.