Are you trying to do this with with Target Display Mode (TDM)? If so, the 2012 is capable but the Mac sending the video signal must be 2019 and older and running no higher macOS than 10.15 "Catalina."
The very restrictive hardware and OS requirementf for TDM are here: Use your iMac as a display with target display mode - Apple Support
When I had two fully TDM-capable Macs (a 2012 Macbook Pro sending to a 2010 iMac 27, I could not get extended desktop as a option, only mirroring. I alway counted that among TDM's numerous deficits.
If you need extended desktop on your 2020 iMac with no image lag, a proper external monitor is the best and most cost-effective way to get it. The Thunderbolt cabling and adapters required for setting up TDM on even supported newer Macs can, at US$60-90, approach the cost of a decent external monitor.