An iMac 7,1 is a Mid 2007 model and can officially handle up to 4GB RAM. Unofficially, it can do 6GB but the special RAM module that allows that party trick is quite expensive, costing up to 3x per GB more than regular RAM. For the OS versions your Mac supports, max of 10.11 El Capitan, 4GB will work fine.
With 4GB RAM aboard you can find the El Capitan installer link in this Apple article:
How to get old versions of macOS - Apple Support
It can install directly over Snow Leopard 10.6 without intermediate steps.
Even with OS 10.11 you will not have the latest Safari and you will encounter web pages that will not work. FireFox still supports macOS 10.1—for now— so it is good option.
I buy Mac RAM ONLY from Crucial.com or Other World Computing. This is the latter's RAM listing for your iMac:
https://eshop.macsales.com/shop/apple/memory/iMac/Intel_Core_2_Duo
Note the huge difference in price between 4GB and the 6GB option:

I would invest $20 in a 2007 Mac I wanted to keep in service, but not nearly $80.