TL;DR: they cover up the seams between the panels that make up the ball.
The internet (other Q&A sites) think that the lines and the bumps are there to improve grip. But I don't see any references to rules in those. That seems to be players' impressions.
The NBA Rulebook has a section on RULE NO. 1: Court Dimensions – Equipment. Section II.f.1 says:
The ball shall be an officially approved NBA ball between 7 ½ and 8 ½ pounds pressure.
It doesn't explain what is necessary to "be an officially approved NBA ball". And that is the most relevant quote (e.g. I don't think that knowing that there must be at least nine balls available helps us).
The NCAA rules PDF has Rule 1, Section 16, Articles
- The ball shall be spherical. Spherical shall be defined as a round body
whose surface at all points is equidistant from the center, except at the approved
black rubber ribs (channels and/or seams).
- The width of the black rubber rib (channels and/or seams) shall not
exceed 1/4 inch.
From this, we get that the ribs are seams (and also known as channels).
More search finds that Spalding was the official NBA ball provider:
...the Spalding NBA Official Game Ball. For over three decades, Spalding has worked with the league to create the gold standard basketball. This ball is designed to feel like second nature in the hands of the legends who wield it. Strictly made for the hardwood, it has a full grain leather construction that turns butter-soft once broken in.
Well, that wasn't helpful. It does provide us with pictures of the ball.
Now Wilson is the official NBA ball provider. The ball is very similar, replacing Spalding with Wilson. Note that Wilson made the official game ball prior to Spalding as well (before the previously mentioned three decades).
Both balls share the black lines. The orange sections are covered with bumps (called pebbling). They differ in that the Wilson puts the writing on top of bumps as well, while the Spalding does not (its writing is smooth, like the ribs/channels).
How a basketball is made. Key takeaway: the lines/ribs (called channels) are overtop the seams of the cover:
- 6 A hand-operated punch press—equipped with specially designed and tooled dies—punches the rubber outlines to create six separate panels per ball. The same die has a hole that is punched in one of the six panels to make an opening for the air tube. The excess rubber surrounding the panels is lifted off the line and deposited in a bin for recycling.
- 7 The assembly worker picks up the six panels for a single ball in a specific order and carries them to the vulcanizer. The interior of the vulcanizer for this process is different from the one for the bladders. It is form-fitted to hold the six panels, to create the channels between the panels, and to add any embossed information. The assembler fits the panels individually into specified sections in the vulcanizer. A bladder/carcass is taken off the overhead conveyor, covered with a coating of glue, and placed inside the chamber of the vulcanizer that is lined with the cover panels. When the ball emerges from the vulcanizer, most of its surface is still smooth (there are no bumps, called pebbling), but the channels and any embossing are formed into the surface.
This suggests that while they may help with grip (as many players believe), the primary purpose is simply to hide the seams between the panels.
The NBA and the ball manufacturers (Wilson and Spalding) have worked together over time to determine the construction of the ball. But they do not seem to publicly describe the characteristics of the ball, although they presumably have some private agreement that specifies the lines/ribs, pebbling, size, and materials.
Note that even if they are primarily to hide the seams, that doesn't mean that they don't improve the grip. The NBA, et. al. may have chosen this particular way to hide the seams because it helps with the grip. The seams on a volleyball are done differently. Possibly because a volleyball gets struck rather than held during active play. And apparently basketballs used to have lacing, like gridiron (American-rules) football still does. Search for Spalding 125th anniversary basketball for examples (Spalding issued a remake of the 1894 ball in 2019).