What results in the price difference for seemingly the same product?
I am considering buy the latest Apple Mac Mini M1 with 512GB storage from Apple or from Amazon. Apple lists it at $899 while Amazon lists it at $859. What is the hardware/software different that results in Amazon being $40 cheaper than from Apple directly?
There's no hardware or software difference.
As with all other retailers, everyone is free to set their own price. The price can be based on all sorts of parameters, which makes it impossible to say exactly why retailer A is xx$ cheaper or more expensive than retailer B.
It could be for example that a retailer has lower costs. For example having an online presence versus a physical presence is typical less costly. Similarly could spending different amounts on customer service, warranty repairs/support, etc.
It could also be that a retailer that is also the maker of the product wants to be in the market at a relatively high price in order to ensure that other retailers find it worth while to sell their products.
It could also be that one retailer earns money from other sources than the specific product sale - and that makes it possible for them to lower their price. For example by gathering data about the customer, or simply by having the customer browsing their web site making it more likely that they will buy other products from the same retailer.
Manufacturers sell to shops at a trade price, let's say 75% of the full retail price. The retailer makes their money from this 25% difference in price. Retailers can reduce the retail price from their cut, if they think that this will attract more customers, in order to sell higher numbers.
The retailer hopes to make more money from a slightly smaller margin by selling more units.
There is no difference in the hardware, and you get the same access to Apple's services - iCloud, Music, TV, etc. You can take it into an Apple Store if you have a problem with it.