Mechanical and Ergonomic keyboard prices suffer because they are niche and way lower volume. The switches are not that expensive if you use common ones, but if you want some special keycaps, prepare to fork some good money. Most of them are made in very low batches and most of the expense is in the molds you have to make. Your $10 keyboard is probably so mass produced that literal millions have been manufactured. Versus custom-ish keyboard designs that are made for at most a thousand buyers.