1. The error#
In RHEL like systems like Rocky or Alma Linux, sometimes public/private key authentication for SSH doesn't work right off the bat. So if you've copied your ssh public key into .ssh/authorized_keys and gave it the correct permissions for both the file and folder above it, and you're still wandering why SSH key login is not working, it is probably because of SElinux environment of the file not setup correctly.
2. The fix#
You can easily fix this by setting the correct context for the authorized_keys file:
chcon system_u:object_r:ssh_home_t:s0 .ssh/authorized_keys
The selinux context should look like this:
ll -Z .ssh/authorized_keys
-rw-------. root root system_u:object_r:ssh_home_t:s0 .ssh/authorized_keys