Ferroelectricity in underdoped La-based cuprates