For the first ball the probability we pick a red ball is the same, it's the number of red balls divided by the total number of balls. Which in this case is 3/9.
If we replace the balls the chance of picking out a 2nd red ball is still 3/9. So the total probability is 3/9 times 3/9 which is 1/9.
If we don't replace the chosen ball. The probability of picking a second is still the number of red balls divided by the new total number which is 2/8 or 1/4. Therefore the total probability is 1/4 times 3/9 which is 1/12.