This is done with a displacement map.
At the base there is a grayscale image, using (for example) black for "no displacement" and white for "maximum move" - a measurement value. Intermediate gray values are translated into a fraction of that maximum value. Each line is divided into segments, and for each segment the displacement is calculated. Then the segments are joined to form smooth lines.
It's not only lines, though. If you look closely, you can see that parts of the lines are obscured by "higher" ones. That means that these are actually filled black objects, with a white outline.
Searching for "displacement map" popped up this question/answer in the Adobe Illustrator forum: https://forums.adobe.com/thread/1149809