You have it around the wrong way has_custom_logo()
will return false if there is no logo.
function_exists( 'the_custom_logo' )
however will return true if you are using a version of WordPress that support this function.
So if you seperate your if statement like below it will work.
if( function_exists( 'the_custom_logo' ) ) {
if(has_custom_logo()) {
the_custom_logo();
} else {
echo "No logo";
}
}