Unfortunately, Apple removed Target Display Mode starting with the 2015 iMac 5K. You could use something like Luna Display to turn an iMac into a remote monitor, but in my experience something like that’s kind of laggy compared to an actual monitor.
I got misled by Apple Sales Support by being told this was possible.
Finally got a sales person who could explain exactly what you folks are describing. Target Display Mode is not supported on iMacs after 2014.
Bummer, now I’m trying to rationalize the purchase of a Studio Display.