typically the lender doesn't see any repayment until after graduation (or unenrollment), and doesn't collect any interest during that period, right?
Interest payments on subsidized loans are paid by the government. If you have an unsubsidized loan and choose not to pay the interest during school, it accrues - meaning the balance of the loan increases by the interest. So while the stated rate on which interest is charged is lower, the effective rate (meaning the rate that corresponds to the amount of interest paid relative to the amount that was borrowed) is higher.
The main reason for the lower rates is that federal student loans are typically not dischargeable in bankruptcy. There is a forgiveness benefit available if you work full-time in a public service job for 10 years. Since these jobs are in underserved areas, they're likely underpaid, so you're trading 10 years of a low salary for the potential benefit of cancelling what's left of your student loans (and the non-financial benefit of serving society). There are other ways to defer payments, or consolidate them into other loans, but there's virtually no way to just get rid of them, unlike personal loans that can be discharged in bankruptcy or consumer loans that can be recovered in a repossession. You basically have to die, become disabled, or work in an underpaid public sector job.
So while the payments can be deferred, the government is still more or less guaranteed to get its money back, hence very low risk of default.
Private student loans are a different story - they are bankruptable, so they have a higher rate to compensate for the additional risk of default.