So as long as you qualify for Sneak Attack, it applies. In your example, the melee attack would trigger Sneak Attack.
You can even get sneak attack on an opportunity attack later in the round because it's only limited to once per turn. Sneak attack is not an attack action, it's a triggered event based on its prerequisites.
The official Sage Advice Compendium confirms this:
Can you use green-flame blade and booming blade with Extra Attack, opportunity attacks, Sneak Attack, and other weapon attack options?
Introduced in the Sword Coast Adventurer’s Guide, the green-flame
blade and booming blade spells pose a number of questions, because
they each do something unusual: require you to make a melee attack
with a weapon as part of the spell’s casting. First, each of these
spells involves a normal melee weapon attack, not a spell attack, so
you use whatever ability modifier you normally use with the weapon. (A
spell tells you if it includes a spell attack, and neither of these
spells do.) For example, if you use a longsword with green-flame
blade, you use your Strength modifier for the weapon’s attack and
damage rolls.
Second, neither green-flame blade nor booming blade works with Extra
Attack or any other feature that requires the Attack action. Like
other spells, these cantrips require the Cast a Spell action, not the
Attack action, and they can’t be used to make an opportunity attack,
unless a special feature allows you to do so.
Third, these weapon attacks work with Sneak Attack if they fulfill the
normal requirements for that feature. For example, if you have the
Sneak Attack feature and cast greenflame blade with a finesse weapon,
you can deal Sneak Attack damage to the target of the weapon attack if
you have advantage on the attack roll and hit.
The base weapon attack that's part of the cantrip doesn't become magical.
Rules designer Jeremy Crawford unofficially addresses this question in a 2017 tweet:
Is the attack made as part of Booming Blade magical? It's delivered as part of a spell, but has its "usual effects" and is a prerequisite for the spell to work.
The booming blade spell isn't intended to make the required weapon attack magical.
So the weapon attack you make as part of the spell is not magical on its own. The two cantrips call for a weapon attack made as part of the cantrip, but the weapon attack on its own is not stated as being modified to become magical; there are simply additional effects to the attack that are granted by the cantrip.
...But the extra damage is magical.
The booming blade spell description says (SCAG, p. 142; emphasis mine):
As part of the action used to cast this spell, you must make a melee attack with a weapon against one creature within the spell’s range, otherwise the spell fails. On a hit, the target suffers the attack’s normal effects, and it becomes sheathed in booming energy until the start of your next turn. If the target willingly moves before then, it immediately takes 1d8 thunder damage, and the spell ends.
Similarly, green-flame blade says (SCAG, p. 143; emphasis mine):
As part of the action used to cast this spell, you must make a melee attack with a weapon against one creature within the spell’s range, otherwise the spell fails. On a hit, the target suffers the attack’s normal effects, and green fire leaps from the target to a different creature of your choice that you can see within 5 feet of it. The second creature takes fire damage equal to your spellcasting ability modifier.
When the caster of either cantrip reaches higher levels, the initial attack does extra damage as well (in addition to boosting the secondary damage).
Per Crawford's unofficial guidance above, the required weapon attack remains nonmagical; the fact that the spell calls for a normal weapon attack doesn't change the properties of the weapon. However, the added damage done by the spell itself is magical, as it's caused directly by the spell. This is true both of the secondary damage of both spells, and of the extra initial damage both spells do at higher levels.
Best Answer
(This answer addresses booming blade and green-flame blade as they were prior to the 2020 Errata of Sword Coast Adventurer’s Guide and may no longer be applicable to the current official version of these spells)
The meaning of "melee attack with a weapon" is different from the meaning of "melee weapon attack". So long as what you use is a weapon (including improvised weapons, but not unarmed strikes) and you make an attack with it, you have fulfilled the precondition. You can even use a ranged weapon (as an improvised weapon) to make a melee attack using these spells.