Building a form and printing in a block
That is what done from user_block(), which contains the following code.

  case 0:
    // For usability's sake, avoid showing two login forms on one page.
    if (!$user-&gt;uid &amp;&amp; !(arg(0) == 'user' &amp;&amp; !is_numeric(arg(1)))) {

      $block['subject'] = t('User login');
      $block['content'] = drupal_get_form('user_login_block');
    }
    return $block;