Even though optimization helps reduce storage, each photo will be put on the new device in a smaller format and will still use up space. If that's too much then you either need to remove some or all photos completely from iCloud completely.
Change your iCloud feature settings [iOS and Mac] - https://support.apple.com/HT207689 - "'When you turn off an iCloud feature on a device, information stored only in iCloud for that feature is no longer available on the device. If you turn off Mail, Contacts, Calendars, Notes, Reminders, or iCloud Photos on just one device, you can still view and change your information on iCloud.com and on another device you set up for that feature."