For the record, this is the rule governing the placement of swimmers from the FINA website.
The rules in track are a little different.
For races from 100m to 800m (and the two relays), the rule is that the top four runners that have qualified are randomly drawn into lanes 3,4, 5 and 6. The last four are randomly assigned to the outer or inner lanes (1-2, 7-8)