There is an easy way to do this. You can disable iCloud Photos sync and delete photos from your iPhone to keep them on iCloud. However, as soon as you enable the iCloud Photos backup, your photos will also be deleted from iCloud. Alternatively, you can use other cloud storage options like Google Drive or OneDrive to store photos and videos on the cloud.