Would it be cowardly for me to go ahead and say agencies are an exception?
I worked at an agency (HUGE in Brooklyn), and was very close to what freelancing is in regard to learning.
It's a steady paycheck, but you're always working on different project, and they're usually fairly cutting edge.
Being surrounded by awesome developers is important too, but you can get that in a co-working space, attending meetups, being part of and contributing to some open-source community, or just hanging out with your developer friends.
I agree that meetups, open source and friends can help with mentorship, but being forced to solve problems in a group is a lot more effective than casual encounters and meetups.
That said, it probably depends on the type of person you are. If you're super outgoing and involved, freelancing full-time is probably similar to working at an agency in that regard, but if that's true it sort works against the point of your post.
I worked at an agency (HUGE in Brooklyn), and was very close to what freelancing is in regard to learning.
It's a steady paycheck, but you're always working on different project, and they're usually fairly cutting edge.
Being surrounded by awesome developers is important too, but you can get that in a co-working space, attending meetups, being part of and contributing to some open-source community, or just hanging out with your developer friends.