The Apple IIgs Hardware reference explains it:
In 640-pixel mode, color selection is more complicated. The 640 pixels in each horizontal line occupy 160 adjacent bytes of memory, each byte representing 4 pixels that appear side-by-side on the screen. The 16 colors in the palette are divided into four groups of 4 colors each. The first pixel in each horizontal line can select one of 4 colors from the third group of 4 in the palette. The second pixel selects from the fourth group of 4 colors in the palette. The third pixel selects from the first group of 4 colors, and the fourth pixel selects from the second group, as shown in Table 4-21. The process repeats for each successive group of 4 pixels in a horizontal line. Thus, even though a given pixel can be one of 4 colors, different pixels in a line can take on any of the 16 colors in a palette.
------------------------------------------------------
Palette Palette
Pixel Value color Pixel Value color
------------------------------------------------------
3 0 0 1 0 8
1 1 1 9
2 2 2 10
3 3 3 11
4 0 4 2 0 12
1 5 1 13
2 6 2 14
3 7 3 15
The Apple IIgs Toolbox Reference Volume II explains the standard 640 mode palette:
------------------------------------------------------------------------
Minipalette Minipalette
Offset Color Value offset Offset Color Value offset
------------------------------------------------------------------------
0 Black 000 0 8 Black 000 0
1 Blue 00F 1 9 Blue 00F 1
2 Yellow FF0 2 10 Yellow FF0 2
3 White FFF 3 11 White FFF 3
4 Black 000 0 12 Black 000 0
5 Red D00 1 13 Red D00 1
6 Green 0E0 2 14 Green 0E0 2
7 White FFF 3 15 White FFF 3
Note: The entries in the minipalettes for the standard 640-mode color table are set up so black and white appear in the same positions in each palette. This provides pure black and white at full 640 resolution, allowing crisper text display.
The standard color dither together to form these 16 colors:
------------------------------
Pixel Dithered
value Name components
-------------------------------
0 Black black, black
1 Dark blue black, blue
2 Olive black, yellow
3 Grey1 black, white
4 Red red, black
5 Purple red, blue
6 Orange red, yellow
7 Pink red, white
8 Green green, black
9 Aquamarine green, blue
10 Lime green green, yellow
11 Light green green, white
12 Grey2 white, black
13 Cornflower blue white, blue
14 Light yellow white, yellow
15 White white, white

To summarize, 320 mode uses a palette of 16 colors. 640 mode splits it up into 4 mini palettes of 4 colors. The palette used is based on the pixel position. With dithering, you can pretend to have 16 colors (but at a 320 resolution). With the standard desktop colors, black and white are available in all 4 mini palettes so they are available at any pixel for true 640 resolution.