If I decided to take a 401k loan (from a traditional 401k), I pay the loan back to myself with interest in after-tax dollars. When I take distributions on these funds in retirement, do I pay tax again on this money?
Assuming that you do not default on the loan and cause it to become a deemed distribution, only the interest paid to the 401(k) on the loan is paid with after-tax dollars. The loan principle is paid back with the before-tax dollars you were originally loaned.
The interest paid to the 401(k) on the loan does not become after-tax basis in the 401(k). You'll pay taxes again on this money when distributed.
If you default on the loan and cause it to become a deemed distribution, which is taxable, the deemed distribution does not satisfy the loan. You'll still be required to pay back the loan but any amounts that you later pay on the loan that are attributable to the deemed-distribution amount become after-tax basis in the 401(k) that will be tax-free when eventually distributed.
the plan must permit loans (otherwise it's a distribution). It must be paid back in 5 years otherwise a deemed distribution. There are limits on the amount that can be loaned. you must pay interest on it. the interest is not tax deductible unless used to buy a principal residence. The plan receives no basis for the interest paid, so it's taxable as part of the distributions you'll take just like if the money was earned form the plans other investments.