I experienced this with earlier versions of Moodle 1.2x off and on while it was in beta (IE6+XP). A few days ago while exploring build 2004042703 of version 1.3, that's all I experienced. After a few hours of trying to determine what "might" be going on, I concluded that the HTML editor was probably the culprit. In my case, a course uploaded that had a different moodledata storage path would 100% of the time cause the bounce to login screen problem, as soon as the HTML editor was fired up. I suppose it was only doing what it thought it was supposed to be doing, as a file browser. It other words, if it was asked to load into its file manager window resources located somewhere in non-public storage, it would attempt to login to that Moodle site (hence the login screen). In fact, I suspect that if you have any files/resources used in Moodle A, and stored in Moodle B, this problem may occur.
The good news is that build 2004043001 (April 30th and later) seems to have fixed the problem. Try as I might, I cannot get things to go south when I fire up the HTML editor, even with resources at another location. The file manager simply displays an error message in the view pane on right, and then nicely lets you select a local Moodle resourse in the left view pane without sending you to the login screen. A fairly stable build I'm finding, so far.
As an aside, if your teacher has more than one cookie for the same Moodle site in their cache, this might also be a problem. Have them flush browser cache while not logged in, and see if problem still persists.