What are the rules when two or more people go out when they are on the bubble for payout
When multiple players are eliminated in the same hand, the player with the least amount of chips at the start of the hand will receive the worst of the available placements, followed by the player that had started with the next least, as so on.  

Mechanically, this is because main and side pots are technically resolved one at a time, and elimination can happen after any single pot resolution.   To extend your example:

Suppose there are 7 players.  At the start of the hand:
A has 500 chips
B has 400 chips
C has 300 chips
D has 150 chips

chip counts for E, F, G don't matter for this example.  For sake of simplicity, assume none of them bet any chips during this hand.

By the end of the hand, players A, B, C, and D have all gone all-in.

Main pot contains 600 chips (D's 150 plus a matching amount from each of the other three players).  All players are eligible to win this pot.

Side pot 1 contains 450 chips (C's remaining 150 plus a matching amount from each of A and B).  A, B, and C are eligible to win this pot.

Side pot 2 contains 200 chips (B's remaining 100 plus a matching amount from A).  A and B are eligible to win this pot.

Side pot 3 contains 100 chips from A and is immediately returned to A.

Assume A or B wins the hand for this example.
The main pot is resolved first.  D did not win and therefore is eliminated, receiving 7th place and no prize.

Side pot 1 is resolved next.  C did not win and therefore is eliminated, receiving 6th place and the associated prize.

(While rare, it is possible for multiple players to be eliminated in the same resolution step.  I assume in this case that the players would share the ranking and the associated winnings.  I don't know what would happen if it was a non-fungible prize, such as top 2 winners advance to next tournament while 2nd and 3rd place tie.)