iCloud Photos is a syncing service. Any photo you delete from a device where iCloud Photos is turned on will also be deleted from iCloud and from any other device connected to iCloud Photos. You can potentially reduce the storage space required on a device by turning on Optimize Storage. See the following Apple article for more information: Set up and use iCloud Photos - Apple Support including the following excerpt:
Turn on Optimize Storage
iCloud Photos keeps all your photos and videos in their original, high-resolution version. To save storage space on your device, you can turn on Optimize Storage.
If you turn on Optimize Storage, iCloud Photos automatically manages the size of your library on your device. Your original photos and videos are stored in iCloud and space-saving versions are kept on your device. Your library is optimized only when you need space, starting with the photos and videos you access least. You can download the original photos and videos over Wi-Fi or cellular when you need them.
If you turn on Download Originals, iCloud Photos keeps your original, full-resolution photos and videos in iCloud and on your device.
On your iPhone, iPad, or Apple Vision Pro
- Go to Settings > [your name] > iCloud.
- Tap Photos.
- Choose Optimize [device] Storage.
Apple does not currently offer cloud-only storage for photos. If that is what you want or need, you may want to explore 3rd party options such as Google Photos or Dropbox.