End-to-end encryption means that only the two parties which are communicating are able to decrypt the message since no third-party has access to the key involved.
iMessages are end-to-end encrypted if you don't use iCloud Backup for it because no third-party has access to said key, which resides on the device and is never made available to anyone else, including Apple.
iMessages are not end-to-end encrypted anymore if you use iCloud Backup because the key is contained in the backup, which Apple hosts on its own servers and is able to decrypt independently. This means Apple, which is a third-party in the context of the iMessages communication, effectively has obtained the encryption key and can decrypt the messages.