Sometimes this is done via course pack, which is handled by the university/library/bookstore. The course packs aren't free, and the cost goes to printing the materials and also royalty payments where necessary.
Some profs may electronically distribute materials separately, which would likely sidestep both of these costs.