Actually, the original sentence is right.
The reason is that the expression "there are advantages to …" should be followed be a noun or nominal phrase:
For example, "there are advantages to global warming." (Note: "global warming" is a nominal phrase).
In order to make "live in an apartment" a nominal phrase, you have to use the gerund form of "to live," which is "living in an apartment."
After nominalizing the phrase, you end up with "there are advantages to (living in an apartment)," where everything in the parentheses is treated as a noun/nominal phrase.