Dell, Lenovo, HP - all offer all-in-ones that start with 8GB RAM, geared for low-end home users. Yes, they cost less in that configuration than the 24" iMac, but all of them use low-end processors, low-end GPUs, and the displays are 1080p.
HP does offer "business" level AIOs, though, and if you look at one of their models:
HP EliteOne 870 G9 27-inch All-in-One it has
8GB RAM, 256GB SSD, a 27" display
that is only 1080p, 250nits, and the price is....
$1,989.
And that is just with an i3 processor. If you want to bump the processor to something closer to the M3, an i7 bumps the price $397.
Dell
is a more competitive on price, but one is also stuck at a low end display and low end internals.
So no, the iMac is not overpriced. It is competitively priced. Price wise the iMac sits between Dell AIOs and HP "business" AIOs, and is superior to them in most regards.