How exactly does module_load_include() load a file into the calling script? Here is the code:

function module_load_include($type, $module, $name = NULL) {
  static $files = array();

  if (!isset($name)) {
    $name = $module;
  }

  $key = $type . ':' . $module . ':' . $name;
  if (isset($files[$key])) {
    return $files[$key];
  }

  if (function_exists('drupal_get_path')) {
    $file = DRUPAL_ROOT . '/' . drupal_get_path('module', $module) . "/$name.$type";
    if (is_file($file)) {
      require_once $file;
      $files[$key] = $file;
      return $file;
    }
    else {
      $files[$key] = FALSE;
    }
  }
  return FALSE;
}


module_load_include() is just a function that calls require_once from within itself to load an external file. But it seems to me that require_once should load external file into module_load_include() and subsequently, this loaded file should disappear when module_load_include() goes out of scope. Somehow "magically" the external file is successfully loaded into the calling script(eg: a page callback function) that calls module_load_include(). I don't understand how this is achieved.
It sounds like you're getting confused on scope. There's no "file scope" in PHP. The include/require statements are pretty much the equivalent of dropping the code within the scope that it's called.  

Per PHP's docs on the include statement:


  When a file is included, the code it contains inherits the variable
  scope of the line on which the include occurs. Any variables available
  at that line in the calling file will be available within the called
  file, from that point forward. However, all functions and classes
  defined in the included file have the global scope.


If definitions in the included file are global. For example: 


global $base_url;
define('MYMODULE_CONST', 123);
function mymodule_function() { }


Then they are global until the script execution ends. 

If definition is not global (e.g. $var1 = 'var1 value';) then it only remains within the scope of the include statement.