Tubes themselves (at least not Italy, UK, or Japan made tubesets) are not terribly expensive. The big difference is what application they are used in and how they can be worked to achieve the desired result (be it the main triangle, fork, or stays).
The real expensive part is the tooling. Tooling is several thousand dollars and if you do low business, then the price of the final frame (to you) is higher. Higher business and it’s obviously lower. Our tooling pricing is typically pretty high because we have a ton of custom bends, clearances, crimping, alignments, and stuff on each frame and fork we make. But we sell enough frames that we can keep costs fairly low. Margins say we should be selling them higher, but that would make them unobtainable for most folks. Plus, if you decide to ride someone else’s frame because of cost, then you aren’t riding ours.
There’s also the cost of the all the doodles and braze-ons you put on the frameset. Dropouts, lugs, re-inforcements, all that jazz. While individually they are cheap, but when you have 13 star re-inforcement dingles on a frame and fork, they stack up quick. Oh, and if you design your own dropouts, cnc them, or cast them. $$$$
There’s different levels of testing. I have ridden a lot of older production and second-hand custom frames that I know would not pass testing standards today. Taiwan values safety and standards very highly which is why super lightweight frames for a variety of riders is very hard and time consuming to build.
Oh and all that above goes same for a fork.
Once you get into fancy, non-made-in-TW tubing from Columbus and Reynolds, the timeline is tripled. And is that stuff notably better than the equivalent butted and designed madeinTW stuff, I don’t think so. It’s the same, just with a sticker.