Yes, this is fine. On the whole, a letter from someone in the department is better than a random one, in that the writer is well-known to the people on the committee. So, certainly this isn't something you should go to trouble to avoid.
EDIT: It seems from comments that the OP is applying to their own undergraduate institution. That's it's own can of worms (many schools heavily discourage this, for good reasons, I think), but I think there's no question that you must get at least one letter from the institution you attended as an undergraduate. It would look really problematic if you didn't (committees would assume no one there would write you a good recommendation, and thus wonder what you did to ruin your reputation).
EDIT 2: Just to comment further, given that the OP also left out that they are changing to a different department from their undergraduate degree. In that case, having a letter from someone in the department is a big help. I don't think the jump from math to statistics is so big, but generally it's very good to have letters from someone who knows the program and what it takes to succeed in it well, which is always tricky when shifting between fields.