(a) The RAMBAM (Hilchos Yom Tov 8:20) does not distinguish between the
Minhag of refraining from Melachah on the second day of Yom Tov outside of
Israel and observing any other Minhag. He simply writes, with regard to all
Minhagim, that if a person has intention to return to his original place
then he may conduct himself according to the Minhag of his original place,
however, he should not do Melachah where others will see him doing it in
order to avoid Machlokes, as our Mishnah (50a-b) says. Presumably, according
to the Rambam one who comes from Eretz Yisrael is permitted to do Melachah
on Yom Tov Sheni in Chutz La'aretz in private. This is indeed the conclusion
of a number of authorities (TAZ, citing MAHARSHAL, in OC 496:2; Harav
Ovadyah Yosef in YECHAVEH DA'AS 3: 35.)
(b) TOSFOS (52a, DH b'Yishuv, see also RAN) writes that the Minhag of
refraining from Melachah on Yom Tov Sheni is more stringent than other
Minhagim, because it is not possible to do Melachah in private without it
becoming known that Melachah was done. (Even though there are some Melachos
that can be done quietly without anyone knowing about them, the Rabanan did
not differentiate and they forbid all Melachos in private, -Machtzis
ha'Shekel OC 496:4.) Therefore, wherever Melachah is forbidden, it is
forbidden even in private.
However, it is not clear exactly in which cases Melachah is normally
forbidden in private. TOSFOS (51a, DH Iy Ata) points out an apparent
contradiction. The Mishnah states unequivocally that one must conduct
himself according to the Chumra of the place at which he has arrived,
because he must avoid causing Machlokes. However, the Gemara says that the
reason one must conduct himself according to the Chumra of the place is
because of the Kusim in that place, who will misunderstand one's practice to
be lenient and they will permit other things which really are forbidden. The
Gemara seems to be saying a different reason than the Mishnah!
Tosfos cites the RI who explains that the Mishnah is talking about a "Minhag
Chashuv," that is, a Minhag with a strong basis. One may not be lenient with
regard to such a Minhag even in front of Talmidei Chachamim who understand
one's reason for being lenient even if he does not plan on returning his
original residence. On the other hand, one *may* be lenient and permit a
Minhag which does not have a strong basis but is based on a mistake or on a
practice that evolved without the consent of the Chachamim. However, even
such a Minhag may not be permitted in front of Kusim.
Next, citing the RASHBA (RABEINU SHIMSHON M'SHANTZ), Tosfos says that the
Mishnah is talking about when the person does *not* have intention to return
to his original place ("Ein Da'ato Lachzhor"), in which case he takes on the
Minhag of the place at which he has arrived whether its populace is learned
or ignorant, since it is as if he has already become a member of that
community. When he has intention to return, though, he does not take on the
Minhag of the new place unless there are Kusim there. (This also appears to
be the ruling of the RAMBAN in Milchamos Hashem.)
The Minhag of Yom Tov Sheni fits the criteria of being a Minhag with a
strong basis (see Beitzah 4b). Therefore, according to the RI, one who comes
from Eretz Yisrael to Chutz la'Aretz would have to take on that Minhag in order to avoid Machlokes, even if one intends to return to Eretz Yisrael.
The RASHBA, though, is more lenient. According to the RASHBA, only if one
does not intend to return to Eretz Yisrael does he have to observe the
second day of Yom Tov in Chutz la'Aretz. If he intends to return to Eretz
Yisrael, then he may do Melachah on the second day of Yom Tov as long as
there are no Kusim in the place, but only Talmidei Chachamim.
As mentioned above, Tosfos holds that with regard to the second day of Yom
Tov, wherever Melachah is forbidden, it is forbidden even in private.
Consequently, one may not do Melachah even in private at all according to
the RI -- even when there are no Kusim around -- and according to the RASHBA
he may not do Melachah in private in a place where there are Kusim.
(c) The BA'AL HA'ME'OR explains that when the Mishnah says that one must be
stringent and follow the Minhag of the place in order to avoid causing
Machlokes, it really means that one must be stringent *only in a place where
there are Kusim*. Accordingly, it should be permitted to do Melachah on Yom
Tov Sheni in a place in which only Talmidei Chachamim reside. However, the
Ba'al ha'Me'or explains that the Minhag of refraining from Melachah on Yom
Tov Sheni is a stronger Minhag than any other, and therefore one must be
stringent and refrain from Melachah even in a place where there are only
Talmidei Chachamim. (The Acharonim understand this to mean that even in
private one may not do Melachah.) If so, not only is Melachah prohibited on
private on Yom Tov Sheni, but in all aspects Yom Tov Sheni must be kept when
in Chutz l'Aretz, even in private.
(d) The RA'AVAD on the RIF writes that when a resident of Eretz Yisrael
travels to Chutz la'Aretz, there is no question of which one of the two
Minhagim should one choose -- to do Melachah on Yom Tov Sheni or not to do
Melachah on Yom Tov Sheni. There is no such thing as a Minhag for a resident
of Eretz Yisrael to do Melachah in Chutz la'Aretz on Yom Tov Sheni. That is,
even someone from Eretz Yisrael has a Minhag to keep Yom Tov Sheni *when in
Chutz la'Aretz*. The Ra'avad apparently learns our Gemara like TOSFOS in
Sukah (43a; see Insights to 51b) that even people from Eretz Yisrael have a
Minhag to keep two days of Yom Tov when they are in a place where the
messengers of Beis Din cannot reach. In other words, their Minhag is that
*when they go to Chutz la'Aretz*, they keep two days of Yom Tov.