"in both the PATTERN and the input files" = "in the pattern and in the input files". The preposition "in" applies to both clauses joined by "both".
If the authors had intended to ignore case distinctions in both the PATTERN and the input filenames, they would have said so.
In comments, OP explains that the Question is incorrectly framed. In response to OP's actual difficulty: The first line of the description on the man page you cite is "grep searches the named input FILEs (...) for lines containing a match to the given PATTERN." That is, grep searches for matches to the contents of files not for matches to their names.
Of course, OP's clarification makes the accepted answer nonresponsive to the hidden question.