The red sand boa is a protected species, and looks like it has two heads, because its tail is shaped like its head to help it defend itself.
The snake is prized on the black market because many believe it brings good luck or has medicinal qualities.
Police in Bangalore arrested four people trying to sell the protected creature for $1,500 (Â£1,100).
Police said plain clothes officers had organised a sting by pretending to be interested buyers.
The market for the "two-headed" red sand boas was "basically another form of cheating", PS Harsha, the local deputy commissioner of police, said.
"It is invariably used to cheat people who have some belief that it will act as good luck charm."
Sharath Babu, a wildlife warden in Bangalore's Urban district, said "it is a fallacy that it has two heads... the head and tail of the snake look alike, so if anyone tries to catch it, it strikes from the other end which is the head".
Thanks to the superstition that the red sand boa will bring its owner treasure, demand for the snake is high, with people even hiring them out for ceremonies, Mr Babu told BBC Hindi.
"It is even used for conducting rituals that would bring in rain or money. It is even believed that the heavier the snake, the more riches it will bring. So, the black market dealers shove ball bearings and other objects into the snakes. These animals die a very painful death."
Luckily for this particular snake, though, it was rescued - and has now been set free in the Bannerghatta Biological Park on the outskirts of Bangalore.

The International Olympic Committee (IOC) has stripped the three of their gold medals, won in Beijing in 2008.
They were among eight athletes sanctioned for doping - the latest to be caught under a retesting programme.
The International Weightlifting Federation (IWF) last year ruled any nations with three or more positive tests would be banned for a year.
The IOC is retesting hundreds of samples from the 2008 and 2012 Olympic Games, using new techniques to uncover cheating that went undetected at the time.
Cao Lei, 33, took gold in the women's 75kg weightlifting event at Beijing, Chen Xiexia, 34, won the women's 48kg and Liu Chunhong, 31, was successful in the women's 69kg. All will now have to return their medals.
The failed retests were uncovered last year but the sanctions - announced by the IOC on Thursday - will clear the way for the IWF to act.
The IWF issued new measures before last year's Rio Olympics to crack down on doping in the sport.
Its executive board decided "national federations confirmed to have produced three or more anti-doping rule violations in the combined re-analysis process of the 2008 and 2012 Olympic Games shall be suspended for one year".
Kazakhstan, Azerbaijan, Russia and Belarus have already been banned by the IWF.
The other five athletes to be sanctioned by the IOC are:
"The protection of clean athletes and the fight against doping are top priorities for the IOC," a spokesperson said,

It is a joint venture between Lacuna Developments, based in Holywood, County Down, and the Welsh firm Watkin Jones.
They have bought the former Willis insurance offices, close to the junction with Botanic Avenue.
The same joint venture is currently converting the former Belfast Metropolitan College building at College Square East into student flats.
It is also planning a student development at the former Athletic Stores building in the city centre.
There are currently plans for more than 4,000 student 'beds' to be developed in Belfast over the next few years.
The latest application, which was filed last week, is for more than 700 units in a development on Donegall Street.
It will form part of the bigger Northside regeneration scheme which includes a hotel, social housing and commercial space.
Most of the planned student accommodation is on the northern edge of the city centre, close to the new campus of the Ulster University.
The latest Watkin Jones/ Lacuna plan is the first private sector scheme close to Queens University, Belfast.
The scheme represents an investment of around Â£10m and the developers are aiming to deliver it by September 2017.
It will be managed by Fresh Student Living, which is involved with the other two schemes.
India police say they have seized a rare snake, known as a "two-headed" red sand boa, from illegal smugglers.
[NEXT_CONCEPT]
China faces a ban from international weightlifting competition after three of its athletes failed doping tests.
[NEXT_CONCEPT]
A student housing developer is planning to build around 150 apartments on the Dublin Road in south Belfast.