Interestingly enough, there was another thread very recently: Unable to run mix local.hex and mix local.rebar
I am thinking maybe it’s an OpenSSL 1.1.1 vs 3.0.x issue. Have you tried installing Erlang with asdf
/ mise
and specify an OpenSSL directory?