Throughout a Moodle site, only teachers are allowed to insert link to images which have been uploaded to their course files folder. Students are only allowed to insert links to URLs, e.g. links to images which are on their own website, etc.
Are you actually logged in as teacher (with full editing rights) when you come across the problem you describe?
I think for all "practical purposes" this is correct; however, anyone with proper access to a course can link to anything uploaded in the teachers file folder. For example, see the image below that is in my files folder of a class. The class is set-up to allow guest access.
This is something that caught me by surprise a few weeks ago. I had always "assumed" that only teachers (and admins of course) were allowed access to files in a course files folder (unless they made someting available via a resource)...that doesn't seem to be the case. It seems anyone who has access to the course, can access those files if they can figure out the proper path. See the discussion below that made me aware of this.
Again, for the purposes of the original question asked in this thread, I think that most people would not know how to link to an item in the course files folder (which is good), but it is possible to do so (which is bad, in my opinion).
This is something that I think is not well understood and has the potential for causing problems if a teacher believes that the files upload area of their courses is only available to them.
Caveat...I'm no programmer. I'm only drawing this conclusion by testing, so if my testing is flawed, then this may all be wrong .