I haven't tried it. But I've seen it done, and more.
When I was a grad student at Berkeley, there was a computational biology class where another student (I'll call him SG) and I hung around afterwards to talk to the professor. I assumed that he, like me, was looking for an advisor. The reality was a bit different.
SG wasn't a student at all. He worked from home as a programmer doing boring stuff and lived an hour away. On Tuesdays and Thursdays he drove to Berkeley, snuck into the CS department by coasting behind someone else who left the door open, and went to the graduate classes he thought were interesting.
On day 1, SG asked the professor if he could sit in without formally registering for class. Sure, why not, the profs don't care about the administrivia. Halfway through the semester, SG explained his whole situation to the prof (and me, because I was waiting around too). How he was extremely motivated, hard working, and wanted to learn, and would work half-time for free indefinitely if someday there might be a job there for him. How could the prof say no?
Over the next few months, SG gets a lot done. A lot more than your average Berkeley grad student with no real-world software engineering experience. So when the prof next gets some grant money, it's a no-brainer to hire him full time. Suddenly SG has an interesting job and a great resume.
Really. You've tried this? Because grad students and professors aren't busy at all...