Doing some research as I was wondering this myself. . .
This forum post at Gamefaqs suggests that:
- (Most?) legendaries can drop anywhere/from anything but
- The chances in most places are extremely low and
- Certain bosses/mobs have significantly higher chances to spawn certain legendaries. Does this apply to certain chests as well? I don't know.
- It seems some legendaries only drop from certain bosses (e.g. conference call). Meant to come back and add this but forgot!
I am doing further research.
Weapons that REGENERATE ammo
Note, the following two weapons require a purchase of the Ultimate Vault Hunter Upgrade pack
Avenger
Counterbution revengence. The reckoning. – High overall stats. Behaves like a bouncing betty grenade when reloaded. Regenerates SMG
ammo when wielded.
Butcher
Fresh Meat! – Very low pellet count. Greatly increased fire rate. Achieves maximum accuracy much more quickly than other Hyperion
shotguns. Magazine randomly refills a random amount of ammo as it's
fired, giving it a wildly variable magazine size in use. Fire rate
highly increases under sustained fire.
Grenade Mods that REGENERATE ammo
The following 4 mods will require purchase of the DLC, Tiny Tina's Assault on Dragonkeep
Lightning Bolt
What's a jigawatt? – Always Shock. Regenerates grenade ammo over
time. Shoots straight forward with a lightning graphic and explodes on
impact. Character may shout "Lightning Bolt!" and a custom throwing
sound will be heard after use while playing in Tiny Tina's Assault on
Dragon Keep.
Chain Lightning
Don't pay it back, pay it forward. – Always Shock. Regenerates grenade
ammo over time. Shoots a bolt of lightning straight forward that
explodes on impact and arcs to nearby targets. Character may shout
"Lightning Bolt!" after use while playing in Tiny Tina's Assault on
Dragon Keep.
Fireball
Porkchop Sandwiches! – Always incendiary. Regenerates grenade ammo
over time. Shoots a slow moving fireball straight forward that
explodes on impact. When used, has a custom sound effect when thrown
and the character may shout "fireball!" while in the DLC Tiny Tina's
Assault on Dragon Keep.
Fire Storm
What manner of man are you that can summon up fire without flint or
tinder? – Always incendiary. Regenerates grenade ammo over time.
Shoots a fireball straight forward that explodes on impact. Four
additional fireballs spawn above the spot of the original explosion
and fall to the ground. Character may shout "Fireball!" upon use while
playing in Tiny Tina's Assault on Dragon Keep.
Magic Missile
No wand required. Just point and shoot. – Always slag. Grenades slowly
regenerate over time. Two (Blue rarity) or Four (Purple rarity) child
grenades home in on targets and explode instantly. Character may shout
"Magic Missile!" after use while playing in Tiny Tina's Assault on
Dragon Keep.
Weapons that DON'T consume any ammo
Infinity:
It's closer than you think! (no it isn't) – Does not consume ammunition. Shots fired form a fixed lemniscate (∞) pattern,
ignoring normal recoil behavior. Increased accuracy when aiming down
the sights.
As an extra note, you'll need to have at least 1 bullet of pistol ammo, or the Infinity will not fire.
Some Vladof launchers:
Vladof launchers can have the special ability "reduced ammo
consumption," which means that every third shot fired is not
deducted from either the magazine or the player's ammo stock. This
is coupled with lower base damage, though the overall destructive
capacity of the weapon remains roughly the same as an equivalent
launcher from most other manufacturers.
Best Answer
Yes, you can buy legendary (orange) weapons in normal vending machines. I can not find any written souce, but I've personally purchased a Shredifier from a gun machine at Raiders HQ in Sanctuary.
I'd assume any legendary that is marked as "drops from any suitable loot source" in the wiki can spawn in a vending machine. Level of the item is equal to the level of vending machine, which is equal to area level - if you go to Southern Shelf on Normal, you'll forever see level 4-6-something items there. As for "class", the type of item is rolled first, than it has the chance to become legendary - no specific rules.
Also, as Dave mentions, there are Torgue machines with legendaries for Torgue tokens, and Seraph vendor with seraph equipment for Seraph crystals.