Yes you can have hosts with different amounts of RAM in a cluster.
HA will work ok as long as one host doesn’t have less RAM than an actual VM needs as a reservation
For example: If you have 3 hosts (2 with 64 GB RAM) and one with 32 GB RAM. If you then have a large VM with a 36 GB reservation then each host needs to be able to power on the largest VM in the event of a failover and in this case the host with 32 GB ram would not be able to power on the VM.