The difference is that ~ is case-sensitive while ~* is not case-sensitive.
In the example below, the path /admin/ would match while /Admin/ would not:
Nginx
location ~ ^/admin/$ {
return 301 https://$host/;
}In this example, both /admin/ and /Admin/ would match and be redirected:
Nginx
location ~* ^/admin/$ {
return 301 https://$host/;
}