The author wanted to avoid a house hopping. She wanted to have characters that interact. It would have been more difficult to let them interact when Harry, Hermione and Ron would have been in different houses. With the setup taken she could show them getting friends without totoo much interaction between Ravenclaw and Gryffindor.