As we read the original sentence, we should notice that the underlined portion has a classic idiom structure that is nearly recognizable: "not ____, but ____". We know that when we have this structure, the thing after the "not" must be parallel with the thing after the "but".
Let's look at each:
A. not an expense
but as an investment ...
We have an "as" after the "but", but not after the "not". If we look at the full sentence, we see that the first "as" comes before the "not", which doesn't work for our parallelism. Eliminate.
B. not expense,
but an investment ...
Missing "an" after "not". Eliminate.
C. not an expense,
rather an investment ...
We lose our "not ____, but ____" structure in this answer! While "not ____, but rather ____" works, "not ____, rather ____" is not idiomatic. Eliminate.
D. not as an expense,
but as an investment ...
This one is parallel — let's keep it.
E. not in terms of expense,
but an investment ...
"In terms of" after "not" isn't reflected after "but", and "an" after "but" isn't reflected after "not". Eliminate.
This leaves us with D as the correct answer.