When you say you "have iCloud turned on", do you mean you have iCloud Photos enabled (among all the various services offered under the iCloud label)? I'll assume so.
The short answer to "How do I delete the photos from my Mac without removing them from iCloud?" is that you don't if you want to keep the Mac connected to iCloud Photos.
iCloud Photos is a syncing service, not a photo storage service. It keeps full-resolution copies of your photos and videos, but copies also remain in the libraries on every device (Mac, iPhone, iPad) connected to the cloud version. Adding photos to one device adds them to the cloud library, then to other devices. Editing photos on one device makes the same edits in the cloud library, then on other devices. Likewise, deleting photos on one device deletes them from the cloud library, then from other devices.
The way to leverage iCloud Photos to reduce (not eliminate) storage use on one of your devices is to enable "Optimize ... Storage" on that device (e.g., "Optimize Mac Storage" on your Mac). After you do that, Photos will automatically detect storage becoming tight on your device and discard the full resolution copies of enough photos to ease the storage constraint, keeping copies with lower resolution. This is fully automatic, with no explicit controls on when Photos decided storage is tight, which photos it chooses to optimize, or when it decides to stop the optimization process.