This only works with 2 drives on the same controller and cable. The floppy controller doesn't know when the disk (hardware) has been switched on the port (software), so a transfer command can be issued on the IBM formatted disk, but run on the Amiga disk.

This answer comes from the documentation for the utility Disk2FDI. Here's an excerpt from docs\tech\rawflopy.doc in the Disk2FDI zip file:

I.2. The algorithm

This algorithm requires two disk drives installed (read the 1DISKDRV.TXT file to get an explanation why reading raw data generally with only 1 disk drive is physically impossible). Insert the disk you want to fully read in one drive (let’s say A: in this example). Insert another disk in the other drive (B: in this example). This disk must be IBM-formatted.

Select drive A: using port 3F2h. Also turn on motors for both A: and B:. Go to the desired track and side using standard FDC 765 commands. Swap to B: using port 3F2h. Select density appropriate for IBM-formatted disk in B: using port 3F7h. Issue a “Read a Track (Diagnostic)” command using the FDC 765. The parameters should match a sector that is physically present on the IBM-formatted disk, for example sector #1. For this command, set a sector size of at least 8KB (even if the physical sector is 512 bytes long). 16KB and 32KB sector sizes can be set to read more raw data. DMA registers should have been set accordingly. Watch continuously the DMA address until it is different from the starting address. When it is so, it means that the 765 has begun transferring sector data, so it has previously found the sector header on B:. As soon as the DMA address is increased, swap to A: using port 3F2h. This is the main idea behind this technique. The 765 has no way to know disk selection has changed because port 3F2h is not linked to it. This 1st step was discovered on the 11th of December, 1999. Change density (bit rate) using port 3F7h. For a full track read, including MFM synchronization bits, you must set a bit rate twice the standard value. For example, when reading a 250 000 bits/sec track (double-density track), set the bit rate to 500 000 bits/sec. This 2nd step was discovered on the 18th of December, 1999.

The FDC 765 will now read the disk in drive A: from now on, thinking it is a big sector on disk in drive B:. Wait for FDC interrupt. Of course, most status bits at the end of this operation should be just ignored, such as the data error (CRC) flag (which will be obviously set). The main indicator of a successful operation is the DMA counter or address. For a 32KB “sector” read, the DMA address will equal the starting address plus 32768 if the operation was successful.

Since some bytes were read at first from drive B:, and the swap of drives and bit rates will require a little time to settle, it is wise not to consider the first 50 bytes read.

If the track to be read contains an IBM sector, drive swapping may not be necessary. Yet, bit rate swapping can be useful, especially for protected or non-standard tracks.