"Paul in this letter to Timothy would impress upon his mind the necessity of giving such instruction as should remove the deception which so easily steals upon the rich, that because of their riches they are superior to those who are in poverty, that because of their ability to acquire they are superior in wisdom and judgment—in short, that gain is godliness. Here is a fearful deception. How few heed the charge which Paul commissioned Timothy to make to the rich! How many flatter themselves that their acquisitiveness is godliness! Paul declares, “Godliness with contentment is great gain.” Although rich persons may devote their whole lives to the one object of getting riches, yet as they brought nothing into the world, they can carry nothing out. They must die and leave that which cost them so much labor to obtain. They staked their all, their eternal interest, to obtain this property, and have lost both worlds. 1T 541.1"
"But godliness with contentment is great gain."
EGW directly quotes and discusses 1 Timothy 6:6, making it an explicit allusion.
"But they that will be rich fall into temptation and a snare, and into many foolish and hurtful lusts, which drown men in destruction and perdition."
Both passages discuss the dangers of pursuing riches and the temptations that come with it. EGW expands on the idea of 'gain is godliness' which is a perversion of the principle in 1 Timothy 6:9.
"Charge them that are rich in this world, that they be not highminded, nor trust in uncertain riches, but in the living God, who giveth us richly all things to enjoy;"
EGW directly references the charge to the rich that Paul gave Timothy. The passage in 1 Timothy 6:17 is the basis for EGW's commentary.