University tuition is free (well, tax-funded, to be precise) - so students typically take out a student loan of approx. $1k/month to cover living expenses. A lot (most?) work part-time on the side to make ends meet.
Part of this loan (methinks ~30%) is converted into a scholarship once you pass your exams, thus leaving you (very roughly) $50,000 in debt after six years in med school.)