The 2012 iMac will actually run Catalina natively, so you can go a bit newer than Mojave. If you want to dabble with unsupported, people have also had success with Big Sur and Monterey, but I can’t speak to that personally. They’re great Macs and still run well if you have an SSD and upgrade the RAM (supports up to 32GB). I only recently replaced mine, and really the only reason that I did was because I needed a laptop. I still found it a fast, responsive, and pleasant computer to use, but I also had pretty much maxed out it’s specs when it was new.
I would say if you’re considering one now, the biggest thing to think about is how you’ll use it. These Macs have dedicated nVidia GPUs, so they still handle most graphical tasks decently. If your parents’ has a hard drive or a fusion drive, you’ll for sure want to replace that. But otherwise, for normal computer usage, browsing, productivity stuff, as long as the software you want to use works on Catalina it’s a very usable and I dare say fast Mac. Aside from current OS support, it has older wifi and Bluetooth hardware, so if you are using wireless, the connections aren’t as fast. It also doesn’t support some Mac OS features like Sidecar or Unlock with Apple Watch because of this. And, of course, the screen is 2560x1440. It’s a great looking display, but it is not the retina 5K display that came a couple of generations later.
I know you said it was coming from your parents, so I assume you’ll get it at a good price, but that’s also a factor, especially if it’s a lower spec model that you’d need to buy an SSD or additional RAM for right off the bat.