- why buy an iMac when with less $$$ I can buy a Windows 10 computer (that is not bad as OS) with the same configuration?
First - if you
don't prefer Mac OS over Windows then, fine, save money and get a Windows system. I've used Windows extensively and could work with it if I had to. I find MacOS better designed, with good attention to detail and more reliable. Also, the majority of software I use is cross-platform. For me, the killer is that I do some web development work targeting Linux servers and its really convenient to work in an environment that is close (admittedly not identical) to the target, but can still handle MS Office, Adobe etc. which are the formats the content tend to arrive in and, anyway, are essential to the day job. If you're more productive in MacOS it's easily worth paying a premium for the hardware (my last Mac lasted me 6 years so it's not hard to amortize...).
Second, you need to check what you mean by "the same configuration". The "Apple Tax" exists, but is widely exaggerated.
You can probably get a Windows
mini-tower with a better CPU and GPU, and far more expansion potential for a significantly lower price than the iMac 27". If you want the maximum CPU power for the minimum cost, and don't mind using Windows then that probably is the best choice.
However, adding a comparable display to that would narrow the gap quite a bit - there
were two 5k displays on the market, from Dell and HP, each costing over $1000 but I'm not even sure those are still in production. Even the 21.5" iMac (apart from the cheapest) has a "proper 4k" 4096x2304 display rather than the "UHD" 3840x1260. Certainly, the iMac range is Apple's best value-for-money.
For example, the Dell XPS 27 is a comparable, compact, all-in-one system with a UHD "4k" (but not 5k) screen. Entry is $1550 (currently on offer at $1400) but with no discrete GPU, next model up is $2149/$1900 (i7 and a RX 570 GPU). C.f. the entry 27" iMac at $1800 (i5 and a AMD Pro 570 GPU). You can't do a perfect comparison (the Dell i7 is not the same i7 as the Apple BTO option, and it's "AMD RX" vs "AMD Radeon Pro" which I know isn't quite the same thing). I'd actually concede that the Dell offers more bang-per-buck
if you ignore the 5k screen but, overall, we are talking a few hundred bucks on a two thousand buck machine - not the 1.5-2x price difference that people imagine.
It
is a problem for consumers that Apple only make luxury sports saloons (and the forthcoming iMac Pro and Mac Pro sound like they're gonna be electric SUVs with gull-wing doors). If you want a pick-up truck then a Windows or Linux machine has to be a consideration.
However, if the cheaper PCs look like someone's thrown together a bucketful of spare parts then that's because someone
has - you can throw together a well-specced PC tower from whatever you can find in a liquidation sale this week because
all the individual component makers, first and foremost, make sure their components work on Windows. The seller makes a profit if they can persuade you to buy an extended warranty and a $50 HDMI cable, and Microsoft gets their license fee every time. Apple doesn't have that advantage - they need premium-priced machines to cover the cost of maintaining their own OS (well, yes, OK,
and to keep their Scrooge McDuck gold-filled swimming pool topped up...)