The bill would exempt professional growers working within certain conditions from punishment, the BBC reports.
But it is not yet law, as it must also get majority support from the Senate.
Buying small amounts of cannabis at so-called coffee shops has long been tolerated in the Netherlands, but cultivating and selling it to the coffee shops is illegal.
Coffee shops often fall back on supplies from criminal networks.
Tuesday’s bill was put forward by an MP for the liberal party, D66, which has long supported a relaxation in the law. It passed with 77 votes to 72, despite the public prosecutor raising concerns legalising cultivation would put the Netherlands in contravention of international law.
The department of health has also been critical.
But it is thought unlikely to get through the Senate, or First Chamber, if the vote goes along the same party lines.
Despite the bill’s uncertain future, those working within the industry have welcomed it as a positive step.
“It is good news for the coffee shop industry because it will finally – if it passes the First Chamber – put an end to a lot of stuff we can’t organise in a normal and transparent way,” Joachim Helms, chairman of the Coffee Shop Union, told the Associated Press news agency.